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.1 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, see <http://www.gnu.org/licenses/>.
19 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GLib Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25 #ifndef __G_DEPRECATED_THREAD_H__
26 #define __G_DEPRECATED_THREAD_H__
28 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29 #error "Only <glib.h> can be included directly."
32 #include <glib/gthread.h>
36 #ifndef G_DISABLE_DEPRECATED
40 G_THREAD_PRIORITY_LOW
,
41 G_THREAD_PRIORITY_NORMAL
,
42 G_THREAD_PRIORITY_HIGH
,
43 G_THREAD_PRIORITY_URGENT
54 GThreadPriority priority
;
57 #ifndef G_DISABLE_DEPRECATED
59 typedef struct _GThreadFunctions GThreadFunctions
;
60 struct _GThreadFunctions
62 GMutex
* (*mutex_new
) (void);
63 void (*mutex_lock
) (GMutex
*mutex
);
64 gboolean (*mutex_trylock
) (GMutex
*mutex
);
65 void (*mutex_unlock
) (GMutex
*mutex
);
66 void (*mutex_free
) (GMutex
*mutex
);
67 GCond
* (*cond_new
) (void);
68 void (*cond_signal
) (GCond
*cond
);
69 void (*cond_broadcast
) (GCond
*cond
);
70 void (*cond_wait
) (GCond
*cond
,
72 gboolean (*cond_timed_wait
) (GCond
*cond
,
75 void (*cond_free
) (GCond
*cond
);
76 GPrivate
* (*private_new
) (GDestroyNotify destructor
);
77 gpointer (*private_get
) (GPrivate
*private_key
);
78 void (*private_set
) (GPrivate
*private_key
,
80 void (*thread_create
) (GThreadFunc func
,
85 GThreadPriority priority
,
88 void (*thread_yield
) (void);
89 void (*thread_join
) (gpointer thread
);
90 void (*thread_exit
) (void);
91 void (*thread_set_priority
)(gpointer thread
,
92 GThreadPriority priority
);
93 void (*thread_self
) (gpointer thread
);
94 gboolean (*thread_equal
) (gpointer thread1
,
98 GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use
;
99 GLIB_VAR gboolean g_thread_use_default_impl
;
101 GLIB_VAR
guint64 (*g_thread_gettime
) (void);
103 GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new
)
104 GThread
*g_thread_create (GThreadFunc func
,
109 GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new
)
110 GThread
*g_thread_create_full (GThreadFunc func
,
115 GThreadPriority priority
,
118 GLIB_DEPRECATED_IN_2_32
119 void g_thread_set_priority (GThread
*thread
,
120 GThreadPriority priority
);
122 GLIB_DEPRECATED_IN_2_32
123 void g_thread_foreach (GFunc thread_func
,
127 #include <sys/types.h>
131 #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
132 #define G_STATIC_MUTEX_INIT { NULL }
137 /* only for ABI compatibility reasons */
138 pthread_mutex_t unused
;
142 #define g_static_mutex_lock(mutex) \
143 g_mutex_lock (g_static_mutex_get_mutex (mutex))
144 #define g_static_mutex_trylock(mutex) \
145 g_mutex_trylock (g_static_mutex_get_mutex (mutex))
146 #define g_static_mutex_unlock(mutex) \
147 g_mutex_unlock (g_static_mutex_get_mutex (mutex))
149 GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init
)
150 void g_static_mutex_init (GStaticMutex
*mutex
);
151 GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_clear
)
152 void g_static_mutex_free (GStaticMutex
*mutex
);
153 GLIB_DEPRECATED_IN_2_32_FOR(GMutex
)
154 GMutex
*g_static_mutex_get_mutex_impl (GStaticMutex
*mutex
);
156 typedef struct _GStaticRecMutex GStaticRecMutex
;
157 struct _GStaticRecMutex
163 /* ABI compat only */
174 #define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
175 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init
)
176 void g_static_rec_mutex_init (GStaticRecMutex
*mutex
);
178 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock
)
179 void g_static_rec_mutex_lock (GStaticRecMutex
*mutex
);
181 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock
)
182 gboolean
g_static_rec_mutex_trylock (GStaticRecMutex
*mutex
);
184 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock
)
185 void g_static_rec_mutex_unlock (GStaticRecMutex
*mutex
);
187 GLIB_DEPRECATED_IN_2_32
188 void g_static_rec_mutex_lock_full (GStaticRecMutex
*mutex
,
191 GLIB_DEPRECATED_IN_2_32
192 guint
g_static_rec_mutex_unlock_full (GStaticRecMutex
*mutex
);
194 GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free
)
195 void g_static_rec_mutex_free (GStaticRecMutex
*mutex
);
197 typedef struct _GStaticRWLock GStaticRWLock
;
198 struct _GStaticRWLock
205 gboolean have_writer
;
210 #define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
212 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init
)
213 void g_static_rw_lock_init (GStaticRWLock
*lock
);
215 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock
)
216 void g_static_rw_lock_reader_lock (GStaticRWLock
*lock
);
218 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock
)
219 gboolean
g_static_rw_lock_reader_trylock (GStaticRWLock
*lock
);
221 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock
)
222 void g_static_rw_lock_reader_unlock (GStaticRWLock
*lock
);
224 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock
)
225 void g_static_rw_lock_writer_lock (GStaticRWLock
*lock
);
227 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock
)
228 gboolean
g_static_rw_lock_writer_trylock (GStaticRWLock
*lock
);
230 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock
)
231 void g_static_rw_lock_writer_unlock (GStaticRWLock
*lock
);
233 GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free
)
234 void g_static_rw_lock_free (GStaticRWLock
*lock
);
236 GLIB_DEPRECATED_IN_2_32
237 GPrivate
* g_private_new (GDestroyNotify notify
);
239 typedef struct _GStaticPrivate GStaticPrivate
;
240 struct _GStaticPrivate
246 #define G_STATIC_PRIVATE_INIT { 0 }
247 GLIB_DEPRECATED_IN_2_32
248 void g_static_private_init (GStaticPrivate
*private_key
);
250 GLIB_DEPRECATED_IN_2_32_FOR(g_private_get
)
251 gpointer
g_static_private_get (GStaticPrivate
*private_key
);
253 GLIB_DEPRECATED_IN_2_32_FOR(g_private_set
)
254 void g_static_private_set (GStaticPrivate
*private_key
,
256 GDestroyNotify notify
);
258 GLIB_DEPRECATED_IN_2_32
259 void g_static_private_free (GStaticPrivate
*private_key
);
261 GLIB_DEPRECATED_IN_2_32
262 gboolean
g_once_init_enter_impl (volatile gsize
*location
);
264 GLIB_DEPRECATED_IN_2_32
265 void g_thread_init (gpointer vtable
);
266 GLIB_DEPRECATED_IN_2_32
267 void g_thread_init_with_errorcheck_mutexes (gpointer vtable
);
269 GLIB_DEPRECATED_IN_2_32
270 gboolean
g_thread_get_initialized (void);
272 GLIB_VAR gboolean g_threads_got_initialized
;
274 #define g_thread_supported() (1)
276 GLIB_DEPRECATED_IN_2_32
277 GMutex
* g_mutex_new (void);
278 GLIB_DEPRECATED_IN_2_32
279 void g_mutex_free (GMutex
*mutex
);
280 GLIB_DEPRECATED_IN_2_32
281 GCond
* g_cond_new (void);
282 GLIB_DEPRECATED_IN_2_32
283 void g_cond_free (GCond
*cond
);
284 GLIB_DEPRECATED_IN_2_32
285 gboolean
g_cond_timed_wait (GCond
*cond
,
293 #endif /* __G_DEPRECATED_THREAD_H__ */