mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-08 03:28:02 +02:00
core: return a boolean in sync API
This commit is contained in:
parent
9b255922ff
commit
e04f935952
2 changed files with 6 additions and 5 deletions
|
|
@ -478,14 +478,14 @@ wp_core_idle_add (WpCore * self, GSourceFunc function, gpointer data)
|
|||
return source;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
wp_core_sync (WpCore * self, GCancellable * cancellable,
|
||||
GAsyncReadyCallback callback, gpointer user_data)
|
||||
{
|
||||
g_autoptr (GTask) task = NULL;
|
||||
int seq;
|
||||
|
||||
g_return_if_fail (WP_IS_CORE (self));
|
||||
g_return_val_if_fail (WP_IS_CORE (self), FALSE);
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ wp_core_sync (WpCore * self, GCancellable * cancellable,
|
|||
g_warn_if_reached ();
|
||||
g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
|
||||
WP_LIBRARY_ERROR_INVARIANT, "No core proxy");
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
seq = pw_core_proxy_sync (self->core_proxy, 0, 0);
|
||||
|
|
@ -501,11 +501,12 @@ wp_core_sync (WpCore * self, GCancellable * cancellable,
|
|||
g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
|
||||
WP_LIBRARY_ERROR_OPERATION_FAILED, "pw_core_proxy_sync failed: %s",
|
||||
g_strerror (-seq));
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_hash_table_insert (self->async_tasks, GINT_TO_POINTER (seq),
|
||||
g_steal_pointer (&task));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct pw_core *
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ WpCore * wp_core_new (GMainContext *context, WpProperties * properties);
|
|||
|
||||
GMainContext * wp_core_get_context (WpCore * self);
|
||||
GSource * wp_core_idle_add (WpCore * self, GSourceFunc function, gpointer data);
|
||||
void wp_core_sync (WpCore * self, GCancellable * cancellable,
|
||||
gboolean wp_core_sync (WpCore * self, GCancellable * cancellable,
|
||||
GAsyncReadyCallback callback, gpointer user_data);
|
||||
struct pw_core * wp_core_get_pw_core (WpCore * self);
|
||||
struct pw_remote * wp_core_get_pw_remote (WpCore * self);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue