mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +01:00
new method to determine if the current thread is the owner of the context.
2005-12-20 Michael Meeks <michael.meeks@novell.com> * glib/gmain.c (g_main_context_is_owner): new method to determine if the current thread is the owner of the context.
This commit is contained in:
parent
a5a39466a1
commit
d2555b65ee
@ -1,3 +1,9 @@
|
||||
2005-12-20 Michael Meeks <michael.meeks@novell.com>
|
||||
|
||||
* glib/gmain.c (g_main_context_is_owner): new method
|
||||
to determine if the current thread is the owner of the
|
||||
context.
|
||||
|
||||
2006-01-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/glib.symbols:
|
||||
|
@ -1,3 +1,9 @@
|
||||
2005-12-20 Michael Meeks <michael.meeks@novell.com>
|
||||
|
||||
* glib/gmain.c (g_main_context_is_owner): new method
|
||||
to determine if the current thread is the owner of the
|
||||
context.
|
||||
|
||||
2006-01-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/glib.symbols:
|
||||
|
@ -1,3 +1,9 @@
|
||||
2005-12-20 Michael Meeks <michael.meeks@novell.com>
|
||||
|
||||
* glib/gmain.c (g_main_context_is_owner): new method
|
||||
to determine if the current thread is the owner of the
|
||||
context.
|
||||
|
||||
2006-01-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/glib.symbols:
|
||||
|
30
glib/gmain.c
30
glib/gmain.c
@ -3156,6 +3156,36 @@ g_main_context_wakeup (GMainContext *context)
|
||||
UNLOCK_CONTEXT (context);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_main_context_is_owner:
|
||||
* @context: a #GMainContext
|
||||
*
|
||||
* Determines whether this thread holds the (recursive)
|
||||
* ownership of this #GMaincontext. This is useful to
|
||||
* know before waiting on another thread that may be
|
||||
* blocking to get ownership of @context.
|
||||
*
|
||||
* Returns: TRUE if current thread is owner of @context.
|
||||
**/
|
||||
gboolean
|
||||
g_main_context_is_owner (GMainContext *context)
|
||||
{
|
||||
gboolean is_owner;
|
||||
|
||||
if (!context)
|
||||
context = g_main_context_default ();
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
LOCK_CONTEXT (context);
|
||||
is_owner = context->owner == G_THREAD_SELF;
|
||||
UNLOCK_CONTEXT (context);
|
||||
#else
|
||||
is_owner = TRUE;
|
||||
#endif
|
||||
|
||||
return is_owner;
|
||||
}
|
||||
|
||||
/* Timeouts */
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user