1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
27 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
28 #error "Only <glib.h> can be included directly."
31 #ifndef __G_DEPRECATED_THREAD_H__
32 #define __G_DEPRECATED_THREAD_H__
34 #include <glib/gthread.h>
40 G_THREAD_PRIORITY_LOW,
41 G_THREAD_PRIORITY_NORMAL,
42 G_THREAD_PRIORITY_HIGH,
43 G_THREAD_PRIORITY_URGENT
52 GThreadPriority priority;
55 typedef struct _GThreadFunctions GThreadFunctions;
56 struct _GThreadFunctions
58 GMutex* (*mutex_new) (void);
59 void (*mutex_lock) (GMutex *mutex);
60 gboolean (*mutex_trylock) (GMutex *mutex);
61 void (*mutex_unlock) (GMutex *mutex);
62 void (*mutex_free) (GMutex *mutex);
63 GCond* (*cond_new) (void);
64 void (*cond_signal) (GCond *cond);
65 void (*cond_broadcast) (GCond *cond);
66 void (*cond_wait) (GCond *cond,
68 gboolean (*cond_timed_wait) (GCond *cond,
71 void (*cond_free) (GCond *cond);
72 GPrivate* (*private_new) (GDestroyNotify destructor);
73 gpointer (*private_get) (GPrivate *private_key);
74 void (*private_set) (GPrivate *private_key,
76 void (*thread_create) (GThreadFunc func,
81 GThreadPriority priority,
84 void (*thread_yield) (void);
85 void (*thread_join) (gpointer thread);
86 void (*thread_exit) (void);
87 void (*thread_set_priority)(gpointer thread,
88 GThreadPriority priority);
89 void (*thread_self) (gpointer thread);
90 gboolean (*thread_equal) (gpointer thread1,
94 GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use;
95 GLIB_VAR gboolean g_thread_use_default_impl;
97 GLIB_VAR guint64 (*g_thread_gettime) (void);
99 GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new)
100 GThread *g_thread_create (GThreadFunc func,
105 GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new)
106 GThread *g_thread_create_full (GThreadFunc func,
111 GThreadPriority priority,
114 GLIB_DEPRECATED_IN_2_32
115 void g_thread_set_priority (GThread *thread,
116 GThreadPriority priority);
118 GLIB_DEPRECATED_IN_2_32
119 void g_thread_foreach (GFunc thread_func,
126 #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
127 #define G_STATIC_MUTEX_INIT { NULL }
132 /* only for ABI compatibility reasons */
133 pthread_mutex_t unused;
137 #define g_static_mutex_lock(mutex) \
138 g_mutex_lock (g_static_mutex_get_mutex (mutex))
139 #define g_static_mutex_trylock(mutex) \
140 g_mutex_trylock (g_static_mutex_get_mutex (mutex))
141 #define g_static_mutex_unlock(mutex) \
142 g_mutex_unlock (g_static_mutex_get_mutex (mutex))
144 GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init)
145 void g_static_mutex_init (GStaticMutex *mutex);
146 GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_free)
147 void g_static_mutex_free (GStaticMutex *mutex);
148 GLIB_DEPRECATED_IN_2_32_FOR(GMutex)
149 GMutex *g_static_mutex_get_mutex_impl (GStaticMutex *mutex);
151 typedef struct _GStaticRecMutex GStaticRecMutex;
152 struct _GStaticRecMutex
158 /* ABI compat only */
169 #define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
170 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init)
171 void g_static_rec_mutex_init (GStaticRecMutex *mutex);
173 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock)
174 void g_static_rec_mutex_lock (GStaticRecMutex *mutex);
176 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock)
177 gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex);
179 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock)
180 void g_static_rec_mutex_unlock (GStaticRecMutex *mutex);
182 GLIB_DEPRECATED_IN_2_32
183 void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
186 GLIB_DEPRECATED_IN_2_32
187 guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
189 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free)
190 void g_static_rec_mutex_free (GStaticRecMutex *mutex);
192 typedef struct _GStaticRWLock GStaticRWLock;
193 struct _GStaticRWLock
200 gboolean have_writer;
205 #define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
207 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init)
208 void g_static_rw_lock_init (GStaticRWLock *lock);
210 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock)
211 void g_static_rw_lock_reader_lock (GStaticRWLock *lock);
213 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock)
214 gboolean g_static_rw_lock_reader_trylock (GStaticRWLock *lock);
216 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock)
217 void g_static_rw_lock_reader_unlock (GStaticRWLock *lock);
219 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock)
220 void g_static_rw_lock_writer_lock (GStaticRWLock *lock);
222 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock)
223 gboolean g_static_rw_lock_writer_trylock (GStaticRWLock *lock);
225 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock)
226 void g_static_rw_lock_writer_unlock (GStaticRWLock *lock);
228 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free)
229 void g_static_rw_lock_free (GStaticRWLock *lock);
231 GLIB_DEPRECATED_IN_2_32
232 GPrivate * g_private_new (GDestroyNotify notify);
234 typedef struct _GStaticPrivate GStaticPrivate;
235 struct _GStaticPrivate
241 #define G_STATIC_PRIVATE_INIT { 0 }
242 GLIB_DEPRECATED_IN_2_32
243 void g_static_private_init (GStaticPrivate *private_key);
245 GLIB_DEPRECATED_IN_2_32_FOR(g_private_get)
246 gpointer g_static_private_get (GStaticPrivate *private_key);
248 GLIB_DEPRECATED_IN_2_32_FOR(g_private_set)
249 void g_static_private_set (GStaticPrivate *private_key,
251 GDestroyNotify notify);
253 GLIB_DEPRECATED_IN_2_32
254 void g_static_private_free (GStaticPrivate *private_key);
256 GLIB_DEPRECATED_IN_2_32
257 gboolean g_once_init_enter_impl (volatile gsize *location);
259 GLIB_DEPRECATED_IN_2_32
260 void g_thread_init (gpointer vtable);
261 GLIB_DEPRECATED_IN_2_32
262 void g_thread_init_with_errorcheck_mutexes (gpointer vtable);
264 GLIB_DEPRECATED_IN_2_32
265 gboolean g_thread_get_initialized (void);
267 GLIB_VAR gboolean g_threads_got_initialized;
269 #define g_thread_supported() (1)
271 GLIB_DEPRECATED_IN_2_32
272 GMutex * g_mutex_new (void);
273 GLIB_DEPRECATED_IN_2_32
274 void g_mutex_free (GMutex *mutex);
275 GLIB_DEPRECATED_IN_2_32
276 GCond * g_cond_new (void);
277 GLIB_DEPRECATED_IN_2_32
278 void g_cond_free (GCond *cond);
279 GLIB_DEPRECATED_IN_2_32
280 gboolean g_cond_timed_wait (GCond *cond,
286 #endif /* __G_DEPRECATED_THREAD_H__ */