Deprecate g_{mutex,cond}_{new,free}()
authorRyan Lortie <desrt@desrt.ca>
Tue, 4 Oct 2011 23:09:43 +0000 (19:09 -0400)
committerRyan Lortie <desrt@desrt.ca>
Wed, 5 Oct 2011 00:08:14 +0000 (20:08 -0400)
Now that we have _init() and _clear(), these old calls are no longer
useful.

https://bugzilla.gnome.org/show_bug.cgi?id=660739

glib/deprecated/gthread-deprecated.c
glib/deprecated/gthread.h
glib/gthread.c
glib/gthread.h

index 8bed9fe..096ffcb 100644 (file)
@@ -1406,5 +1406,89 @@ g_static_private_cleanup (GRealThread *thread)
     }
 }
 
+/* GMutex {{{1 ------------------------------------------------------ */
+
+/**
+ * g_mutex_new:
+ *
+ * Allocates and initializes a new #GMutex.
+ *
+ * Returns: a newly allocated #GMutex. Use g_mutex_free() to free
+ *
+ * Deprecated:3.32:GMutex can now be statically allocated, or embedded
+ * in structures and initialised with g_mutex_init().
+ */
+GMutex *
+g_mutex_new (void)
+{
+  GMutex *mutex;
+
+  mutex = g_slice_new (GMutex);
+  g_mutex_init (mutex);
+
+  return mutex;
+}
+
+/**
+ * g_mutex_free:
+ * @mutex: a #GMutex
+ *
+ * Destroys a @mutex that has been created with g_mutex_new().
+ *
+ * Calling g_mutex_free() on a locked mutex may result
+ * in undefined behaviour.
+ *
+ * Deprecated:3.32:GMutex can now be statically allocated, or embedded
+ * in structures and initialised with g_mutex_init().
+ */
+void
+g_mutex_free (GMutex *mutex)
+{
+  g_mutex_clear (mutex);
+  g_slice_free (GMutex, mutex);
+}
+
+/* GCond {{{1 ------------------------------------------------------ */
+
+/**
+ * g_cond_new:
+ *
+ * Allocates and initializes a new #GCond.
+ *
+ * Returns: a newly allocated #GCond. Free with g_cond_free()
+ *
+ * Deprecated:3.32:GCond can now be statically allocated, or embedded
+ * in structures and initialised with g_cond_init().
+ */
+GCond *
+g_cond_new (void)
+{
+  GCond *cond;
+
+  cond = g_slice_new (GCond);
+  g_cond_init (cond);
+
+  return cond;
+}
+
+/**
+ * g_cond_free:
+ * @cond: a #GCond
+ *
+ * Destroys a #GCond that has been created with g_cond_new().
+ *
+ * Calling g_cond_free() for a #GCond on which threads are
+ * blocking leads to undefined behaviour.
+ *
+ * Deprecated:3.32:GCond can now be statically allocated, or embedded
+ * in structures and initialised with g_cond_init().
+ */
+void
+g_cond_free (GCond *cond)
+{
+  g_cond_clear (cond);
+  g_slice_free (GCond, cond);
+}
+
 /* {{{1 Epilogue */
 /* vim: set foldmethod=marker: */
index cd6549e..f7b1439 100644 (file)
@@ -214,6 +214,10 @@ GLIB_VAR gboolean g_threads_got_initialized;
 
 GMutex* g_static_mutex_get_mutex_impl   (GMutex **mutex);
 
+GMutex *                g_mutex_new                                     (void);
+void                    g_mutex_free                                    (GMutex         *mutex);
+GCond *                 g_cond_new                                      (void);
+void                    g_cond_free                                     (GCond          *cond);
 
 G_END_DECLS
 
index 72ac2d8..9b328da 100644 (file)
@@ -1022,77 +1022,5 @@ g_thread_self (void)
   return (GThread*)thread;
 }
 
-/* GMutex {{{1 ------------------------------------------------------ */
-
-/**
- * g_mutex_new:
- *
- * Allocates and initializes a new #GMutex.
- *
- * Returns: a newly allocated #GMutex. Use g_mutex_free() to free
- */
-GMutex *
-g_mutex_new (void)
-{
-  GMutex *mutex;
-
-  mutex = g_slice_new (GMutex);
-  g_mutex_init (mutex);
-
-  return mutex;
-}
-
-/**
- * g_mutex_free:
- * @mutex: a #GMutex
- *
- * Destroys a @mutex that has been created with g_mutex_new().
- *
- * Calling g_mutex_free() on a locked mutex may result
- * in undefined behaviour.
- */
-void
-g_mutex_free (GMutex *mutex)
-{
-  g_mutex_clear (mutex);
-  g_slice_free (GMutex, mutex);
-}
-
-/* GCond {{{1 ------------------------------------------------------ */
-
-/**
- * g_cond_new:
- *
- * Allocates and initializes a new #GCond.
- *
- * Returns: a newly allocated #GCond. Free with g_cond_free()
- */
-GCond *
-g_cond_new (void)
-{
-  GCond *cond;
-
-  cond = g_slice_new (GCond);
-  g_cond_init (cond);
-
-  return cond;
-}
-
-/**
- * g_cond_free:
- * @cond: a #GCond
- *
- * Destroys a #GCond that has been created with g_cond_new().
- *
- * Calling g_cond_free() for a #GCond on which threads are
- * blocking leads to undefined behaviour.
- */
-void
-g_cond_free (GCond *cond)
-{
-  g_cond_clear (cond);
-  g_slice_free (GCond, cond);
-}
-
 /* Epilogue {{{1 */
 /* vim: set foldmethod=marker: */
index 9021d10..3ec378a 100644 (file)
@@ -198,8 +198,6 @@ void            g_once_init_leave       (volatile void *location,
 #endif /* !G_DEBUG_LOCKS */
 
 
-GMutex *                g_mutex_new                                     (void);
-void                    g_mutex_free                                    (GMutex         *mutex);
 void                    g_mutex_init                                    (GMutex         *mutex);
 void                    g_mutex_clear                                   (GMutex         *mutex);
 
@@ -222,8 +220,6 @@ void                    g_rec_mutex_lock                                (GRecMut
 gboolean                g_rec_mutex_trylock                             (GRecMutex      *rec_mutex);
 void                    g_rec_mutex_unlock                              (GRecMutex      *rec_mutex);
 
-GCond *                 g_cond_new                                      (void);
-void                    g_cond_free                                     (GCond          *cond);
 void                    g_cond_init                                     (GCond          *cond);
 void                    g_cond_clear                                    (GCond          *cond);