Don't mark GThread struct as deprecated
[platform/upstream/glib.git] / glib / deprecated / gthread.h
index d15dd9d..4c7b304 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * GLib at ftp://ftp.gtk.org/pub/gtk/.
  */
 
-#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
-#error "Only <glib.h> can be included directly."
-#endif
-
 #ifndef __G_DEPRECATED_THREAD_H__
 #define __G_DEPRECATED_THREAD_H__
 
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
 #include <glib/gthread.h>
 
 G_BEGIN_DECLS
 
+#ifndef G_DISABLE_DEPRECATED
+
 typedef enum
 {
   G_THREAD_PRIORITY_LOW,
@@ -43,6 +43,8 @@ typedef enum
   G_THREAD_PRIORITY_URGENT
 } GThreadPriority;
 
+#endif
+
 struct  _GThread
 {
   /*< private >*/
@@ -52,6 +54,8 @@ struct  _GThread
   GThreadPriority priority;
 };
 
+#ifndef G_DISABLE_DEPRECATED
+
 typedef struct _GThreadFunctions GThreadFunctions;
 struct _GThreadFunctions
 {
@@ -96,25 +100,31 @@ GLIB_VAR gboolean               g_thread_use_default_impl;
 
 GLIB_VAR guint64   (*g_thread_gettime) (void);
 
-GThread* g_thread_create       (GThreadFunc            func,
-                                gpointer               data,
-                                gboolean               joinable,
-                                GError               **error) G_GNUC_DEPRECATED_FOR(g_thread_new);
-GThread* g_thread_create_full  (GThreadFunc            func,
-                                gpointer               data,
-                                gulong                 stack_size,
-                                gboolean               joinable,
-                                gboolean               bound,
-                                GThreadPriority        priority,
-                                GError               **error) G_GNUC_DEPRECATED_FOR(g_thread_new_full);
-
-void g_thread_set_priority     (GThread         *thread,
-                                GThreadPriority  priority) G_GNUC_DEPRECATED;
-
-void     g_thread_foreach      (GFunc         thread_func,
-                                gpointer      user_data) G_GNUC_DEPRECATED;
+GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new)
+GThread *g_thread_create       (GThreadFunc       func,
+                                gpointer          data,
+                                gboolean          joinable,
+                                GError          **error);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new)
+GThread *g_thread_create_full  (GThreadFunc       func,
+                                gpointer          data,
+                                gulong            stack_size,
+                                gboolean          joinable,
+                                gboolean          bound,
+                                GThreadPriority   priority,
+                                GError          **error);
+
+GLIB_DEPRECATED_IN_2_32
+void     g_thread_set_priority (GThread          *thread,
+                                GThreadPriority   priority);
+
+GLIB_DEPRECATED_IN_2_32
+void     g_thread_foreach      (GFunc             thread_func,
+                                gpointer          user_data);
 
 #ifndef G_OS_WIN32
+#include <sys/types.h>
 #include <pthread.h>
 #endif
 
@@ -135,9 +145,13 @@ typedef struct
     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) G_GNUC_DEPRECATED_FOR(g_mutex_init);
-void g_static_mutex_free (GStaticMutex *mutex) G_GNUC_DEPRECATED_FOR(g_mutex_free);
-GMutex* g_static_mutex_get_mutex_impl   (GStaticMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init)
+void    g_static_mutex_init           (GStaticMutex *mutex);
+GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_clear)
+void    g_static_mutex_free           (GStaticMutex *mutex);
+GLIB_DEPRECATED_IN_2_32_FOR(GMutex)
+GMutex *g_static_mutex_get_mutex_impl (GStaticMutex *mutex);
 
 typedef struct _GStaticRecMutex GStaticRecMutex;
 struct _GStaticRecMutex
@@ -145,18 +159,40 @@ struct _GStaticRecMutex
   /*< private >*/
   GStaticMutex mutex;
   guint depth;
-  GSystemThread owner;
+
+  /* ABI compat only */
+  union {
+#ifdef G_OS_WIN32
+    void *owner;
+#else
+    pthread_t owner;
+#endif
+    gdouble dummy;
+  } unused;
 };
 
-#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, {{0, 0, 0, 0}} }
-void     g_static_rec_mutex_init        (GStaticRecMutex *mutex) G_GNUC_DEPRECATED_FOR(g_rec_mutex_init);
-void     g_static_rec_mutex_lock        (GStaticRecMutex *mutex) G_GNUC_DEPRECATED_FOR(g_rec_mutex_lock);
-gboolean g_static_rec_mutex_trylock     (GStaticRecMutex *mutex) G_GNUC_DEPRECATED_FOR(g_rec_mutex_try_lock);
-void     g_static_rec_mutex_unlock      (GStaticRecMutex *mutex) G_GNUC_DEPRECATED_FOR(g_rec_mutex_unlock);
+#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init)
+void     g_static_rec_mutex_init        (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock)
+void     g_static_rec_mutex_lock        (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock)
+gboolean g_static_rec_mutex_trylock     (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock)
+void     g_static_rec_mutex_unlock      (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32
 void     g_static_rec_mutex_lock_full   (GStaticRecMutex *mutex,
-                                         guint            depth) G_GNUC_DEPRECATED;
-guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex) G_GNUC_DEPRECATED;
-void     g_static_rec_mutex_free        (GStaticRecMutex *mutex) G_GNUC_DEPRECATED_FOR(g_rec_mutex_free);
+                                         guint            depth);
+
+GLIB_DEPRECATED_IN_2_32
+guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free)
+void     g_static_rec_mutex_free        (GStaticRecMutex *mutex);
 
 typedef struct _GStaticRWLock GStaticRWLock;
 struct _GStaticRWLock
@@ -173,16 +209,32 @@ struct _GStaticRWLock
 
 #define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
 
-void      g_static_rw_lock_init           (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_init);
-void      g_static_rw_lock_reader_lock    (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_reader_lock);
-gboolean  g_static_rw_lock_reader_trylock (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_reader_trylock);
-void      g_static_rw_lock_reader_unlock  (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_reader_unlock);
-void      g_static_rw_lock_writer_lock    (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_writer_lock);
-gboolean  g_static_rw_lock_writer_trylock (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_writer_trylock);
-void      g_static_rw_lock_writer_unlock  (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_writer_unlock);
-void      g_static_rw_lock_free           (GStaticRWLock* lock) G_GNUC_DEPRECATED_FOR(g_rw_lock_free);
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init)
+void      g_static_rw_lock_init           (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock)
+void      g_static_rw_lock_reader_lock    (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock)
+gboolean  g_static_rw_lock_reader_trylock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock)
+void      g_static_rw_lock_reader_unlock  (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock)
+void      g_static_rw_lock_writer_lock    (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock)
+gboolean  g_static_rw_lock_writer_trylock (GStaticRWLock *lock);
 
-GPrivate *      g_private_new             (GDestroyNotify  notify) G_GNUC_DEPRECATED;
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock)
+void      g_static_rw_lock_writer_unlock  (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free)
+void      g_static_rw_lock_free           (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32
+GPrivate *      g_private_new             (GDestroyNotify notify);
 
 typedef struct _GStaticPrivate  GStaticPrivate;
 struct _GStaticPrivate
@@ -192,31 +244,49 @@ struct _GStaticPrivate
 };
 
 #define G_STATIC_PRIVATE_INIT { 0 }
-void     g_static_private_init           (GStaticPrivate   *private_key) G_GNUC_DEPRECATED;
-gpointer g_static_private_get            (GStaticPrivate   *private_key) G_GNUC_DEPRECATED_FOR(g_private_get);
-void     g_static_private_set            (GStaticPrivate   *private_key,
-                                          gpointer          data,
-                                          GDestroyNotify    notify) G_GNUC_DEPRECATED_FOR(g_private_set);
-void     g_static_private_free           (GStaticPrivate   *private_key) G_GNUC_DEPRECATED;
+GLIB_DEPRECATED_IN_2_32
+void     g_static_private_init           (GStaticPrivate *private_key);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_private_get)
+gpointer g_static_private_get            (GStaticPrivate *private_key);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_private_set)
+void     g_static_private_set            (GStaticPrivate *private_key,
+                                          gpointer        data,
+                                          GDestroyNotify  notify);
 
-gboolean g_once_init_enter_impl          (volatile gsize   *location) G_GNUC_DEPRECATED;
+GLIB_DEPRECATED_IN_2_32
+void     g_static_private_free           (GStaticPrivate *private_key);
 
-void     g_thread_init   (gpointer vtable) G_GNUC_DEPRECATED;
+GLIB_DEPRECATED_IN_2_32
+gboolean g_once_init_enter_impl          (volatile gsize *location);
 
-gboolean g_thread_get_initialized (void) G_GNUC_DEPRECATED;
+GLIB_DEPRECATED_IN_2_32
+void     g_thread_init                   (gpointer vtable);
+GLIB_DEPRECATED_IN_2_32
+void    g_thread_init_with_errorcheck_mutexes (gpointer vtable);
+
+GLIB_DEPRECATED_IN_2_32
+gboolean g_thread_get_initialized        (void);
 
 GLIB_VAR gboolean g_threads_got_initialized;
 
-#if defined(G_THREADS_MANDATORY)
-#define g_thread_supported()     1
-#else
-#define g_thread_supported()    (g_threads_got_initialized)
-#endif
+#define g_thread_supported()     (1)
+
+GLIB_DEPRECATED_IN_2_32
+GMutex *        g_mutex_new             (void);
+GLIB_DEPRECATED_IN_2_32
+void            g_mutex_free            (GMutex *mutex);
+GLIB_DEPRECATED_IN_2_32
+GCond *         g_cond_new              (void);
+GLIB_DEPRECATED_IN_2_32
+void            g_cond_free             (GCond  *cond);
+GLIB_DEPRECATED_IN_2_32
+gboolean        g_cond_timed_wait       (GCond          *cond,
+                                         GMutex         *mutex,
+                                         GTimeVal       *timeval);
 
-GMutex *                g_mutex_new                                     (void) G_GNUC_DEPRECATED;
-void                    g_mutex_free                                    (GMutex         *mutex) G_GNUC_DEPRECATED;
-GCond *                 g_cond_new                                      (void) G_GNUC_DEPRECATED;
-void                    g_cond_free                                     (GCond          *cond) G_GNUC_DEPRECATED;
+#endif
 
 G_END_DECLS