From 65056180dd2fee9187426354e8ef5161bf980578 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Sun, 2 Oct 2011 23:37:20 -0400 Subject: [PATCH] locks: Add initialisation notes For each of the 4, mention that static storage or _init() is needed. --- glib/gthread.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/glib/gthread.c b/glib/gthread.c index 86f1a21..1709489 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -289,6 +289,10 @@ * * * + * If a #GMutex is allocated in static storage then it can be used + * without initialisation. Otherwise, you should call g_mutex_init() on + * it and g_mutex_clear() when done. + * * A statically initialized #GMutex provides an even simpler and safer * way of doing this: * @@ -326,6 +330,10 @@ * thread without deadlock. When doing so, care has to be taken to * unlock the recursive mutex as often as it has been locked. * + * If a #GRecMutex is allocated in static storage then it can be used + * without initialisation. Otherwise, you should call + * g_rec_mutex_init() on it and g_rec_mutex_clear() when done. + * * A GRecMutex should only be accessed with the * g_rec_mutex_ functions. * @@ -396,6 +404,10 @@ * * * + * If a #GRWLock is allocated in static storage then it can be used + * without initialisation. Otherwise, you should call + * g_rw_lock_init() on it and g_rw_lock_clear() when done. + * * A GRWLock should only be accessed with the * g_rw_lock_ functions. * @@ -461,6 +473,10 @@ * to be woken up, even if the condition itself is protected by a * #GMutex, like above. * + * If a #GCond is allocated in static storage then it can be used + * without initialisation. Otherwise, you should call g_cond_init() on + * it and g_cond_clear() when done. + * * A #GCond should only be accessed via the g_cond_ * functions. */ -- 2.7.4