Skip to content
Snippets Groups Projects
Commit e04f9359 authored by Julian Bouzas's avatar Julian Bouzas
Browse files

core: return a boolean in sync API

parent 9b255922
No related branches found
No related tags found
No related merge requests found
...@@ -478,14 +478,14 @@ wp_core_idle_add (WpCore * self, GSourceFunc function, gpointer data) ...@@ -478,14 +478,14 @@ wp_core_idle_add (WpCore * self, GSourceFunc function, gpointer data)
return source; return source;
} }
void gboolean
wp_core_sync (WpCore * self, GCancellable * cancellable, wp_core_sync (WpCore * self, GCancellable * cancellable,
GAsyncReadyCallback callback, gpointer user_data) GAsyncReadyCallback callback, gpointer user_data)
{ {
g_autoptr (GTask) task = NULL; g_autoptr (GTask) task = NULL;
int seq; 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); task = g_task_new (self, cancellable, callback, user_data);
...@@ -493,7 +493,7 @@ wp_core_sync (WpCore * self, GCancellable * cancellable, ...@@ -493,7 +493,7 @@ wp_core_sync (WpCore * self, GCancellable * cancellable,
g_warn_if_reached (); g_warn_if_reached ();
g_task_return_new_error (task, WP_DOMAIN_LIBRARY, g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
WP_LIBRARY_ERROR_INVARIANT, "No core proxy"); WP_LIBRARY_ERROR_INVARIANT, "No core proxy");
return; return FALSE;
} }
seq = pw_core_proxy_sync (self->core_proxy, 0, 0); seq = pw_core_proxy_sync (self->core_proxy, 0, 0);
...@@ -501,11 +501,12 @@ wp_core_sync (WpCore * self, GCancellable * cancellable, ...@@ -501,11 +501,12 @@ wp_core_sync (WpCore * self, GCancellable * cancellable,
g_task_return_new_error (task, WP_DOMAIN_LIBRARY, g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
WP_LIBRARY_ERROR_OPERATION_FAILED, "pw_core_proxy_sync failed: %s", WP_LIBRARY_ERROR_OPERATION_FAILED, "pw_core_proxy_sync failed: %s",
g_strerror (-seq)); g_strerror (-seq));
return; return FALSE;
} }
g_hash_table_insert (self->async_tasks, GINT_TO_POINTER (seq), g_hash_table_insert (self->async_tasks, GINT_TO_POINTER (seq),
g_steal_pointer (&task)); g_steal_pointer (&task));
return TRUE;
} }
struct pw_core * struct pw_core *
......
...@@ -41,7 +41,7 @@ WpCore * wp_core_new (GMainContext *context, WpProperties * properties); ...@@ -41,7 +41,7 @@ WpCore * wp_core_new (GMainContext *context, WpProperties * properties);
GMainContext * wp_core_get_context (WpCore * self); GMainContext * wp_core_get_context (WpCore * self);
GSource * wp_core_idle_add (WpCore * self, GSourceFunc function, gpointer data); 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); GAsyncReadyCallback callback, gpointer user_data);
struct pw_core * wp_core_get_pw_core (WpCore * self); struct pw_core * wp_core_get_pw_core (WpCore * self);
struct pw_remote * wp_core_get_pw_remote (WpCore * self); struct pw_remote * wp_core_get_pw_remote (WpCore * self);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment