gpointer data;
GDestroyNotify notify;
- GMutex *ack_lock;
- GCond *ack_condition;
+ GMutex ack_lock;
+ GCond ack_condition;
} MainLoopProxy;
static gboolean
if (proxy->notify)
proxy->notify (proxy->data);
-
- if (proxy->ack_lock)
- {
- g_mutex_lock (proxy->ack_lock);
- g_cond_signal (proxy->ack_condition);
- g_mutex_unlock (proxy->ack_lock);
- }
-
+
+ g_mutex_lock (&proxy->ack_lock);
+ g_cond_signal (&proxy->ack_condition);
+ g_mutex_unlock (&proxy->ack_lock);
+
return FALSE;
}
static void
mainloop_proxy_free (MainLoopProxy *proxy)
{
- if (proxy->ack_lock)
- {
- g_mutex_free (proxy->ack_lock);
- g_cond_free (proxy->ack_condition);
- }
-
+ g_mutex_clear (&proxy->ack_lock);
+ g_cond_clear (&proxy->ack_condition);
g_free (proxy);
}
proxy->func = func;
proxy->data = user_data;
proxy->notify = notify;
- proxy->ack_lock = g_mutex_new ();
- proxy->ack_condition = g_cond_new ();
- g_mutex_lock (proxy->ack_lock);
-
+ g_mutex_init (&proxy->ack_lock);
+ g_cond_init (&proxy->ack_condition);
+ g_mutex_lock (&proxy->ack_lock);
+
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, mainloop_proxy_func, proxy,
g_source_attach (source, job->context);
g_source_unref (source);
- g_cond_wait (proxy->ack_condition, proxy->ack_lock);
- g_mutex_unlock (proxy->ack_lock);
+ g_cond_wait (&proxy->ack_condition, &proxy->ack_lock);
+ g_mutex_unlock (&proxy->ack_lock);
ret_val = proxy->ret_val;
mainloop_proxy_free (proxy);
proxy->func = func;
proxy->data = user_data;
proxy->notify = notify;
-
+ g_mutex_init (&proxy->ack_lock);
+ g_cond_init (&proxy->ack_condition);
+
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, mainloop_proxy_func, proxy,
G_DEFINE_TYPE (GTlsInteraction, g_tls_interaction, G_TYPE_OBJECT);
typedef struct {
- GMutex *mutex;
+ GMutex mutex;
/* Input arguments */
GTlsInteraction *interaction;
GTlsInteractionResult result;
GError *error;
gboolean complete;
- GCond *cond;
+ GCond cond;
} InvokeClosure;
static void
g_object_unref (closure->interaction);
g_clear_object (&closure->argument);
g_clear_object (&closure->cancellable);
- g_cond_free (closure->cond);
- g_mutex_free (closure->mutex);
+ g_cond_clear (&closure->cond);
+ g_mutex_clear (&closure->mutex);
g_clear_error (&closure->error);
/* Insurance that we've actually used these before freeing */
closure->interaction = g_object_ref (interaction);
closure->argument = argument ? g_object_ref (argument) : NULL;
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
- closure->mutex = g_mutex_new ();
- closure->cond = g_cond_new ();
+ g_mutex_init (&closure->mutex);
+ g_cond_init (&closure->cond);
closure->result = G_TLS_INTERACTION_UNHANDLED;
return closure;
}
{
GTlsInteractionResult result;
- g_mutex_lock (closure->mutex);
+ g_mutex_lock (&closure->mutex);
while (!closure->complete)
- g_cond_wait (closure->cond, closure->mutex);
+ g_cond_wait (&closure->cond, &closure->mutex);
- g_mutex_unlock (closure->mutex);
+ g_mutex_unlock (&closure->mutex);
if (closure->error)
{
InvokeClosure *closure = user_data;
GTlsInteractionClass *klass;
- g_mutex_lock (closure->mutex);
+ g_mutex_lock (&closure->mutex);
klass = G_TLS_INTERACTION_GET_CLASS (closure->interaction);
g_assert (klass->ask_password);
&closure->error);
closure->complete = TRUE;
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ g_cond_signal (&closure->cond);
+ g_mutex_unlock (&closure->mutex);
return FALSE; /* don't call again */
}
InvokeClosure *closure = user_data;
GTlsInteractionClass *klass;
- g_mutex_lock (closure->mutex);
+ g_mutex_lock (&closure->mutex);
klass = G_TLS_INTERACTION_GET_CLASS (closure->interaction);
g_assert (klass->ask_password_finish);
&closure->error);
closure->complete = TRUE;
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ g_cond_signal (&closure->cond);
+ g_mutex_unlock (&closure->mutex);
}
static gboolean
InvokeClosure *closure = user_data;
GTlsInteractionClass *klass;
- g_mutex_lock (closure->mutex);
+ g_mutex_lock (&closure->mutex);
klass = G_TLS_INTERACTION_GET_CLASS (closure->interaction);
g_assert (klass->ask_password_async);
closure->callback = NULL;
closure->user_data = NULL;
- g_mutex_unlock (closure->mutex);
+ g_mutex_unlock (&closure->mutex);
return FALSE; /* don't call again */
}
{
while (!closure->complete)
{
- g_mutex_unlock (closure->mutex);
+ g_mutex_unlock (&closure->mutex);
g_main_context_iteration (interaction->priv->context, TRUE);
- g_mutex_lock (closure->mutex);
+ g_mutex_lock (&closure->mutex);
}
g_main_context_release (interaction->priv->context);