[glib] Deprecate g_{mutex,cond}_{new,free}()



commit 69c0b4440eabd5898066b36caccac9a34d783a78
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Oct 4 19:09:43 2011 -0400

    Deprecate g_{mutex,cond}_{new,free}()
    
    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 |   84 ++++++++++++++++++++++++++++++++++
 glib/deprecated/gthread.h            |    4 ++
 glib/gthread.c                       |   72 -----------------------------
 glib/gthread.h                       |    4 --
 4 files changed, 88 insertions(+), 76 deletions(-)
---
diff --git a/glib/deprecated/gthread-deprecated.c b/glib/deprecated/gthread-deprecated.c
index 8bed9fe..096ffcb 100644
--- a/glib/deprecated/gthread-deprecated.c
+++ b/glib/deprecated/gthread-deprecated.c
@@ -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: */
diff --git a/glib/deprecated/gthread.h b/glib/deprecated/gthread.h
index cd6549e..f7b1439 100644
--- a/glib/deprecated/gthread.h
+++ b/glib/deprecated/gthread.h
@@ -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
 
diff --git a/glib/gthread.c b/glib/gthread.c
index 72ac2d8..9b328da 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -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: */
diff --git a/glib/gthread.h b/glib/gthread.h
index 9021d10..3ec378a 100644
--- a/glib/gthread.h
+++ b/glib/gthread.h
@@ -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);
 



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