/* Returns: TRUE if the operation succeeded, and this thread is now the owner of @context.  */
gboolean g_main_context_acquire(GMainContext *context)
/* Returns: TRUE if the operation succeeded, and this thread is now the owner of @context.  */
gboolean g_main_context_acquire(GMainContext *context)
{
  gboolean result = FALSE;
  GThread *self = G_THREAD_SELF;
  if (context == NULL)
    context = g_main_context_default ();
  LOCK_CONTEXT (context);
  if (!context->owner)
    {
      context->owner = self;
      g_assert (context->owner_count == 0);
    }
  if (context->owner == self)
    {
      context->owner_count++;
      result = TRUE;
    }
  UNLOCK_CONTEXT (context); 
  return result;
}