/* Releases ownership of a context previously acquired by this thread with g_main_context_acquire(). If the context was acquired multiple times, the ownership will be released only when g_main_context_release() is called as many times as it was acquired.  */
void g_main_context_release(GMainContext *context)
/* Releases ownership of a context previously acquired by this thread with g_main_context_acquire(). If the context was acquired multiple times, the ownership will be released only when g_main_context_release() is called as many times as it was acquired.  */
void g_main_context_release(GMainContext *context)
{
  if (context == NULL)
    context = g_main_context_default ();
  LOCK_CONTEXT (context);
  context->owner_count--;
  if (context->owner_count == 0)
    {
      context->owner = NULL;
      if (context->waiters)
	{
	  GMainWaiter *waiter = context->waiters->data;
	  gboolean loop_internal_waiter = (waiter->mutex == &context->mutex);
	  context->waiters = g_slist_delete_link (context->waiters,
						  context->waiters);
	  if (!loop_internal_waiter)
	    g_mutex_lock (waiter->mutex);
	  g_cond_signal (waiter->cond);
	  if (!loop_internal_waiter)
	    g_mutex_unlock (waiter->mutex);
	}
    }
  UNLOCK_CONTEXT (context); 
}