[glib/wip/mutexes] Deprecate GStatic{,Rec,RW}Mutex



commit 2eba8436d2cfb44cc07388976c6b26e3127c8ea9
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Sep 21 14:57:22 2011 -0400

    Deprecate GStatic{,Rec,RW}Mutex
    
    The new versions use the primatives of the OS directly and don't have an
    annoying ABI.

 glib/deprecated/gthread.h |   65 +++++++++++++++++++++++++++++++++++++++++++++
 glib/gthread.h            |   65 ---------------------------------------------
 2 files changed, 65 insertions(+), 65 deletions(-)
---
diff --git a/glib/deprecated/gthread.h b/glib/deprecated/gthread.h
index 4425de1..9b09e1d 100644
--- a/glib/deprecated/gthread.h
+++ b/glib/deprecated/gthread.h
@@ -107,6 +107,71 @@ GThread* g_thread_create_full  (GThreadFunc            func,
                                 GThreadPriority        priority,
                                 GError               **error);
 
+#ifdef G_OS_WIN32
+typedef GMutex * GStaticMutex;
+#define G_STATIC_MUTEX_INIT NULL
+#define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
+#else /* G_OS_WIN32 */
+typedef struct {
+  struct _GMutex *unused;
+  GMutex mutex;
+} GStaticMutex;
+#define G_STATIC_MUTEX_INIT { NULL, G_MUTEX_INIT }
+#define g_static_mutex_get_mutex(s) (&(s)->mutex)
+#endif /* G_OS_WIN32 */
+
+#define g_static_mutex_lock(mutex) \
+    g_mutex_lock (g_static_mutex_get_mutex (mutex))
+#define g_static_mutex_trylock(mutex) \
+    g_mutex_trylock (g_static_mutex_get_mutex (mutex))
+#define g_static_mutex_unlock(mutex) \
+    g_mutex_unlock (g_static_mutex_get_mutex (mutex))
+void g_static_mutex_init (GStaticMutex *mutex);
+void g_static_mutex_free (GStaticMutex *mutex);
+
+typedef struct _GStaticRecMutex GStaticRecMutex;
+struct _GStaticRecMutex
+{
+  /*< private >*/
+  GStaticMutex mutex;
+  guint depth;
+  GSystemThread owner;
+};
+
+#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, {{0, 0, 0, 0}} }
+void     g_static_rec_mutex_init        (GStaticRecMutex *mutex);
+void     g_static_rec_mutex_lock        (GStaticRecMutex *mutex);
+gboolean g_static_rec_mutex_trylock     (GStaticRecMutex *mutex);
+void     g_static_rec_mutex_unlock      (GStaticRecMutex *mutex);
+void     g_static_rec_mutex_lock_full   (GStaticRecMutex *mutex,
+                                         guint            depth);
+guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
+void     g_static_rec_mutex_free        (GStaticRecMutex *mutex);
+
+typedef struct _GStaticRWLock GStaticRWLock;
+struct _GStaticRWLock
+{
+  /*< private >*/
+  GStaticMutex mutex;
+  GCond *read_cond;
+  GCond *write_cond;
+  guint read_counter;
+  gboolean have_writer;
+  guint want_to_read;
+  guint want_to_write;
+};
+
+#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
+
+void      g_static_rw_lock_init           (GStaticRWLock* lock);
+void      g_static_rw_lock_reader_lock    (GStaticRWLock* lock);
+gboolean  g_static_rw_lock_reader_trylock (GStaticRWLock* lock);
+void      g_static_rw_lock_reader_unlock  (GStaticRWLock* lock);
+void      g_static_rw_lock_writer_lock    (GStaticRWLock* lock);
+gboolean  g_static_rw_lock_writer_trylock (GStaticRWLock* lock);
+void      g_static_rw_lock_writer_unlock  (GStaticRWLock* lock);
+void      g_static_rw_lock_free           (GStaticRWLock* lock);
+
 G_END_DECLS
 
 #endif /* __G_DEPRECATED_THREAD_H__ */
diff --git a/glib/gthread.h b/glib/gthread.h
index 48d5326..f500d3e 100644
--- a/glib/gthread.h
+++ b/glib/gthread.h
@@ -149,28 +149,6 @@ void     g_thread_yield                  (void);
 void     g_thread_foreach                (GFunc         thread_func,
                                           gpointer      user_data);
 
-#ifdef G_OS_WIN32
-typedef GMutex * GStaticMutex;
-#define G_STATIC_MUTEX_INIT NULL
-#define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
-#else /* G_OS_WIN32 */
-typedef struct {
-  struct _GMutex *unused;
-  GMutex mutex;
-} GStaticMutex;
-#define G_STATIC_MUTEX_INIT { NULL, G_MUTEX_INIT }
-#define g_static_mutex_get_mutex(s) (&(s)->mutex)
-#endif /* G_OS_WIN32 */
-
-#define g_static_mutex_lock(mutex) \
-    g_mutex_lock (g_static_mutex_get_mutex (mutex))
-#define g_static_mutex_trylock(mutex) \
-    g_mutex_trylock (g_static_mutex_get_mutex (mutex))
-#define g_static_mutex_unlock(mutex) \
-    g_mutex_unlock (g_static_mutex_get_mutex (mutex))
-void g_static_mutex_init (GStaticMutex *mutex);
-void g_static_mutex_free (GStaticMutex *mutex);
-
 struct _GStaticPrivate
 {
   /*< private >*/
@@ -184,49 +162,6 @@ void     g_static_private_set            (GStaticPrivate   *private_key,
 					  GDestroyNotify    notify);
 void     g_static_private_free           (GStaticPrivate   *private_key);
 
-typedef struct _GStaticRecMutex GStaticRecMutex;
-struct _GStaticRecMutex
-{
-  /*< private >*/
-  GStaticMutex mutex;
-  guint depth;
-  GSystemThread owner;
-};
-
-#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, {{0, 0, 0, 0}} }
-void     g_static_rec_mutex_init        (GStaticRecMutex *mutex);
-void     g_static_rec_mutex_lock        (GStaticRecMutex *mutex);
-gboolean g_static_rec_mutex_trylock     (GStaticRecMutex *mutex);
-void     g_static_rec_mutex_unlock      (GStaticRecMutex *mutex);
-void     g_static_rec_mutex_lock_full   (GStaticRecMutex *mutex,
-                                         guint            depth);
-guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
-void     g_static_rec_mutex_free        (GStaticRecMutex *mutex);
-
-typedef struct _GStaticRWLock GStaticRWLock;
-struct _GStaticRWLock
-{
-  /*< private >*/
-  GStaticMutex mutex;
-  GCond *read_cond;
-  GCond *write_cond;
-  guint read_counter;
-  gboolean have_writer;
-  guint want_to_read;
-  guint want_to_write;
-};
-
-#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
-
-void      g_static_rw_lock_init           (GStaticRWLock* lock);
-void      g_static_rw_lock_reader_lock    (GStaticRWLock* lock);
-gboolean  g_static_rw_lock_reader_trylock (GStaticRWLock* lock);
-void      g_static_rw_lock_reader_unlock  (GStaticRWLock* lock);
-void      g_static_rw_lock_writer_lock    (GStaticRWLock* lock);
-gboolean  g_static_rw_lock_writer_trylock (GStaticRWLock* lock);
-void      g_static_rw_lock_writer_unlock  (GStaticRWLock* lock);
-void      g_static_rw_lock_free           (GStaticRWLock* lock);
-
 typedef enum
 {
   G_ONCE_STATUS_NOTCALLED,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]