1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * gthread.c: posix thread system implementation
5 * Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
25 * file for a list of people on the GLib Team. See the ChangeLog
26 * files for a list of changes. These files are distributed with
27 * GLib at ftp://ftp.gtk.org/pub/gtk/.
30 /* The GMutex, GCond and GPrivate implementations in this file are some
31 * of the lowest-level code in GLib. All other parts of GLib (messages,
32 * memory, slices, etc) assume that they can freely use these facilities
33 * without risking recursion.
35 * As such, these functions are NOT permitted to call any other part of
38 * The thread manipulation functions (create, exit, join, etc.) have
39 * more freedom -- they can do as they please.
45 #include "gthreadprivate.h"
55 g_thread_abort (gint status,
56 const gchar *function)
58 fprintf (stderr, "GLib (gthread-posix.c): Unexpected error from C library during '%s': %s. Aborting.\n",
59 strerror (status), function);
68 * Initializer for statically allocated #GMutexes.
69 * Alternatively, g_mutex_init() can be used.
72 * GMutex mutex = G_MUTEX_INIT;
80 * @mutex: an uninitialized #GMutex
82 * Initializes a #GMutex so that it can be used.
84 * This function is useful to initialize a mutex that has been
85 * allocated on the stack, or as part of a larger structure.
86 * It is not necessary to initialize a mutex that has been
87 * created with g_mutex_new(). Also see #G_MUTEX_INIT for an
88 * alternative way to initialize statically allocated mutexes.
98 * b = g_new (Blob, 1);
99 * g_mutex_init (&b->m);
102 * To undo the effect of g_mutex_init() when a mutex is no longer
103 * needed, use g_mutex_clear().
105 * Calling g_mutex_init() on an already initialized #GMutex leads
106 * to undefined behaviour.
111 g_mutex_init (GMutex *mutex)
114 pthread_mutexattr_t *pattr = NULL;
115 #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
116 pthread_mutexattr_t attr;
117 pthread_mutexattr_init (&attr);
118 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
122 if G_UNLIKELY ((status = pthread_mutex_init (&mutex->impl, pattr)) != 0)
123 g_thread_abort (status, "pthread_mutex_init");
125 #ifdef PTHREAD_ADAPTIVE_MUTEX_NP
126 pthread_mutexattr_destroy (&attr);
132 * @mutex: an initialized #GMutex
134 * Frees the resources allocated to a mutex with g_mutex_init().
136 * #GMutexes that have have been created with g_mutex_new() should
137 * be freed with g_mutex_free() instead.
139 * Calling g_mutex_clear() on a locked mutex leads to undefined
145 g_mutex_clear (GMutex *mutex)
149 if G_UNLIKELY ((status = pthread_mutex_destroy (&mutex->impl)) != 0)
150 g_thread_abort (status, "pthread_mutex_destroy");
157 * Locks @mutex. If @mutex is already locked by another thread, the
158 * current thread will block until @mutex is unlocked by the other
161 * This function can be used even if g_thread_init() has not yet been
162 * called, and, in that case, will do nothing.
164 * <note>#GMutex is neither guaranteed to be recursive nor to be
165 * non-recursive, i.e. a thread could deadlock while calling
166 * g_mutex_lock(), if it already has locked @mutex. Use
167 * #GRecMutex if you need recursive mutexes.</note>
170 g_mutex_lock (GMutex *mutex)
174 if G_UNLIKELY ((status = pthread_mutex_lock (&mutex->impl)) != 0)
175 g_thread_abort (status, "pthread_mutex_lock");
182 * Unlocks @mutex. If another thread is blocked in a g_mutex_lock()
183 * call for @mutex, it will become unblocked and can lock @mutex itself.
185 * Calling g_mutex_unlock() on a mutex that is not locked by the
186 * current thread leads to undefined behaviour.
188 * This function can be used even if g_thread_init() has not yet been
189 * called, and, in that case, will do nothing.
192 g_mutex_unlock (GMutex *mutex)
196 if G_UNLIKELY ((status = pthread_mutex_unlock (&mutex->impl)) != 0)
197 g_thread_abort (status, "pthread_mutex_lock");
204 * Tries to lock @mutex. If @mutex is already locked by another thread,
205 * it immediately returns %FALSE. Otherwise it locks @mutex and returns
208 * This function can be used even if g_thread_init() has not yet been
209 * called, and, in that case, will immediately return %TRUE.
211 * <note>#GMutex is neither guaranteed to be recursive nor to be
212 * non-recursive, i.e. the return value of g_mutex_trylock() could be
213 * both %FALSE or %TRUE, if the current thread already has locked
214 * @mutex. Use #GRecMutex if you need recursive mutexes.</note>
216 * Returns: %TRUE if @mutex could be locked
219 g_mutex_trylock (GMutex *mutex)
223 if G_LIKELY ((status = pthread_mutex_trylock (&mutex->impl)) == 0)
226 if G_UNLIKELY (status != EBUSY)
227 g_thread_abort (status, "pthread_mutex_trylock");
237 * The GRecMutex struct is an opaque data structure to represent a
238 * recursive mutex. It is similar to a #GMutex with the difference
239 * that it is possible to lock a GRecMutex multiple times in the same
240 * thread without deadlock. When doing so, care has to be taken to
241 * unlock the recursive mutex as often as it has been locked.
243 * A GRecMutex should only be accessed with the
244 * <function>g_rec_mutex_</function> functions. Before a GRecMutex
245 * can be used, it has to be initialized with #G_REC_MUTEX_INIT or
246 * g_rec_mutex_init().
251 static pthread_mutex_t *
252 g_rec_mutex_impl_new (void)
254 pthread_mutexattr_t attr;
255 pthread_mutex_t *mutex;
257 mutex = g_slice_new (pthread_mutex_t);
258 pthread_mutexattr_init (&attr);
259 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
260 pthread_mutex_init (mutex, &attr);
261 pthread_mutexattr_destroy (&attr);
267 g_rec_mutex_impl_free (pthread_mutex_t *mutex)
269 pthread_mutex_destroy (mutex);
270 g_slice_free (pthread_mutex_t, mutex);
273 static pthread_mutex_t *
274 g_rec_mutex_get_impl (GRecMutex *mutex)
276 pthread_mutex_t *impl = mutex->impl;
278 if G_UNLIKELY (mutex->impl == NULL)
280 impl = g_rec_mutex_impl_new ();
281 if (!g_atomic_pointer_compare_and_exchange (&mutex->impl, NULL, impl))
282 g_rec_mutex_impl_free (impl);
292 * Initializer for statically allocated #GRecMutexes.
293 * Alternatively, g_rec_mutex_init() can be used.
296 * GRecMutex mutex = G_REC_MUTEX_INIT;
304 * @rec_mutex: an uninitialized #GRecMutex
306 * Initializes a #GRecMutex so that it can be used.
308 * This function is useful to initialize a recursive mutex
309 * that has been allocated on the stack, or as part of a larger
311 * It is not necessary to initialize a recursive mutex that has
312 * been created with g_rec_mutex_new(). Also see #G_REC_MUTEX_INIT
313 * for an alternative way to initialize statically allocated
324 * b = g_new (Blob, 1);
325 * g_rec_mutex_init (&b->m);
328 * Calling g_rec_mutex_init() on an already initialized #GRecMutex
329 * leads to undefined behaviour.
331 * To undo the effect of g_rec_mutex_init() when a recursive mutex
332 * is no longer needed, use g_rec_mutex_clear().
337 g_rec_mutex_init (GRecMutex *rec_mutex)
339 rec_mutex->impl = g_rec_mutex_impl_new ();
344 * @rec_mutex: an initialized #GRecMutex
346 * Frees the resources allocated to a recursive mutex with
347 * g_rec_mutex_init().
349 * #GRecMutexes that have have been created with g_rec_mutex_new()
350 * should be freed with g_rec_mutex_free() instead.
352 * Calling g_rec_mutex_clear() on a locked recursive mutex leads
353 * to undefined behaviour.
358 g_rec_mutex_clear (GRecMutex *rec_mutex)
361 g_rec_mutex_impl_free (rec_mutex->impl);
366 * @rec_mutex: a #GRecMutex
368 * Locks @rec_mutex. If @rec_mutex is already locked by another
369 * thread, the current thread will block until @rec_mutex is
370 * unlocked by the other thread. If @rec_mutex is already locked
371 * by the current thread, the 'lock count' of @rec_mutex is increased.
372 * The mutex will only become available again when it is unlocked
373 * as many times as it has been locked.
378 g_rec_mutex_lock (GRecMutex *mutex)
380 pthread_mutex_lock (g_rec_mutex_get_impl (mutex));
384 * g_rec_mutex_unlock:
385 * @rec_mutex: a #RecGMutex
387 * Unlocks @rec_mutex. If another thread is blocked in a
388 * g_rec_mutex_lock() call for @rec_mutex, it will become unblocked
389 * and can lock @rec_mutex itself.
391 * Calling g_rec_mutex_unlock() on a recursive mutex that is not
392 * locked by the current thread leads to undefined behaviour.
397 g_rec_mutex_unlock (GRecMutex *rec_mutex)
399 pthread_mutex_unlock (rec_mutex->impl);
403 * g_rec_mutex_trylock:
404 * @rec_mutex: a #GRecMutex
406 * Tries to lock @rec_mutex. If @rec_mutex is already locked
407 * by another thread, it immediately returns %FALSE. Otherwise
408 * it locks @rec_mutex and returns %TRUE.
410 * Returns: %TRUE if @rec_mutex could be locked
415 g_rec_mutex_trylock (GRecMutex *rec_mutex)
417 if (pthread_mutex_trylock (g_rec_mutex_get_impl (rec_mutex)) != 0)
428 * The GRWLock struct is an opaque data structure to represent a
429 * reader-writer lock. It is similar to a #GMutex in that it allows
430 * multiple threads to coordinate access to a shared resource.
432 * The difference to a mutex is that a reader-writer lock discriminates
433 * between read-only ('reader') and full ('writer') access. While only
434 * one thread at a time is allowed write access (by holding the 'writer'
435 * lock via g_rw_lock_writer_lock()), multiple threads can gain
436 * simultaneous read-only access (by holding the 'reader' lock via
437 * g_rw_lock_reader_lock()).
440 * <title>An array with access functions</title>
442 * GRWLock lock = G_RW_LOCK_INIT;
446 * my_array_get (guint index)
448 * gpointer retval = NULL;
453 * g_rw_lock_reader_lock (&lock);
454 * if (index < array->len)
455 * retval = g_ptr_array_index (array, index);
456 * g_rw_lock_reader_unlock (&lock);
462 * my_array_set (guint index, gpointer data)
464 * g_rw_lock_writer_lock (&lock);
467 * array = g_ptr_array_new (<!-- -->);
469 * if (index >= array->len)
470 * g_ptr_array_set_size (array, index+1);
471 * g_ptr_array_index (array, index) = data;
473 * g_rw_lock_writer_unlock (&lock);
477 * This example shows an array which can be accessed by many readers
478 * (the <function>my_array_get()</function> function) simultaneously,
479 * whereas the writers (the <function>my_array_set()</function>
480 * function) will only be allowed once at a time and only if no readers
481 * currently access the array. This is because of the potentially
482 * dangerous resizing of the array. Using these functions is fully
483 * multi-thread safe now.
487 * A GRWLock should only be accessed with the
488 * <function>g_rw_lock_</function> functions. Before it can be used,
489 * it has to be initialized with #G_RW_LOCK_INIT or g_rw_lock_init().
497 * Initializer for statically allocated #GRWLocks.
498 * Alternatively, g_rw_lock_init_init() can be used.
501 * GRWLock lock = G_RW_LOCK_INIT;
509 * @lock: an uninitialized #GRWLock
511 * Initializes a #GRWLock so that it can be used.
513 * This function is useful to initialize a lock that has been
514 * allocated on the stack, or as part of a larger structure.
515 * Also see #G_RW_LOCK_INIT for an alternative way to initialize
516 * statically allocated locks.
526 * b = g_new (Blob, 1);
527 * g_rw_lock_init (&b->l);
530 * To undo the effect of g_rw_lock_init() when a lock is no longer
531 * needed, use g_rw_lock_clear().
533 * Calling g_rw_lock_init() on an already initialized #GRWLock leads
534 * to undefined behaviour.
539 g_rw_lock_init (GRWLock *lock)
541 pthread_rwlock_init (&lock->impl, NULL);
546 * @lock: an initialized #GRWLock
548 * Frees the resources allocated to a lock with g_rw_lock_init().
550 * Calling g_rw_lock_clear() when any thread holds the lock
551 * leads to undefined behaviour.
556 g_rw_lock_clear (GRWLock *lock)
558 pthread_rwlock_destroy (&lock->impl);
562 * g_rw_lock_writer_lock:
565 * Obtain a write lock on @lock. If any thread already holds
566 * a read or write lock on @lock, the current thread will block
567 * until all other threads have dropped their locks on @lock.
572 g_rw_lock_writer_lock (GRWLock *lock)
574 pthread_rwlock_wrlock (&lock->impl);
578 * g_rw_lock_writer_trylock:
581 * Tries to obtain a write lock on @lock. If any other thread holds
582 * a read or write lock on @lock, it immediately returns %FALSE.
583 * Otherwise it locks @lock and returns %TRUE.
585 * Returns: %TRUE if @lock could be locked
590 g_rw_lock_writer_trylock (GRWLock *lock)
592 if (pthread_rwlock_trywrlock (&lock->impl) != 0)
599 * g_rw_lock_writer_unlock:
602 * Release a write lock on @lock.
604 * Calling g_rw_lock_writer_unlock() on a lock that is not held
605 * by the current thread leads to undefined behaviour.
610 g_rw_lock_writer_unlock (GRWLock *lock)
612 pthread_rwlock_unlock (&lock->impl);
616 * g_rw_lock_reader_lock:
619 * Obtain a read lock on @lock. If another thread currently holds
620 * the write lock on @lock or blocks waiting for it, the current
621 * thread will block. Read locks can be taken recursively.
623 * It is implementation-defined how many threads are allowed to
624 * hold read locks on the same lock simultaneously.
629 g_rw_lock_reader_lock (GRWLock *lock)
631 pthread_rwlock_rdlock (&lock->impl);
635 * g_rw_lock_reader_trylock:
638 * Tries to obtain a read lock on @lock and returns %TRUE if
639 * the read lock was successfully obtained. Otherwise it
642 * Returns: %TRUE if @lock could be locked
647 g_rw_lock_reader_trylock (GRWLock *lock)
649 if (pthread_rwlock_tryrdlock (&lock->impl) != 0)
656 * g_rw_lock_reader_unlock:
659 * Release a read lock on @lock.
661 * Calling g_rw_lock_reader_unlock() on a lock that is not held
662 * by the current thread leads to undefined behaviour.
667 g_rw_lock_reader_unlock (GRWLock *lock)
669 pthread_rwlock_unlock (&lock->impl);
677 * Initializer for statically allocated #GConds.
678 * Alternatively, g_cond_init() can be used.
681 * GCond cond = G_COND_INIT;
689 * @cond: an uninitialized #GCond
691 * Initialized a #GCond so that it can be used.
693 * This function is useful to initialize a #GCond that has been
694 * allocated on the stack, or as part of a larger structure.
695 * It is not necessary to initialize a #GCond that has been
696 * created with g_cond_new(). Also see #G_COND_INIT for an
697 * alternative way to initialize statically allocated #GConds.
699 * To undo the effect of g_cond_init() when a #GCond is no longer
700 * needed, use g_cond_clear().
702 * Calling g_cond_init() on an already initialized #GCond leads
703 * to undefined behaviour.
708 g_cond_init (GCond *cond)
712 if G_UNLIKELY ((status = pthread_cond_init (&cond->impl, NULL)) != 0)
713 g_thread_abort (status, "pthread_cond_init");
718 * @cond: an initialized #GCond
720 * Frees the resources allocated to a #GCond with g_cond_init().
722 * #GConds that have been created with g_cond_new() should
723 * be freed with g_cond_free() instead.
725 * Calling g_cond_clear() for a #GCond on which threads are
726 * blocking leads to undefined behaviour.
731 g_cond_clear (GCond *cond)
735 if G_UNLIKELY ((status = pthread_cond_destroy (&cond->impl)) != 0)
736 g_thread_abort (status, "pthread_cond_destroy");
742 * @mutex: a #GMutex that is currently locked
744 * Waits until this thread is woken up on @cond. The @mutex is unlocked
745 * before falling asleep and locked again before resuming.
747 * This function can be used even if g_thread_init() has not yet been
748 * called, and, in that case, will immediately return.
751 g_cond_wait (GCond *cond,
756 if G_UNLIKELY ((status = pthread_cond_wait (&cond->impl, &mutex->impl)) != 0)
757 g_thread_abort (status, "pthread_cond_wait");
764 * If threads are waiting for @cond, at least one of them is unblocked.
765 * If no threads are waiting for @cond, this function has no effect.
766 * It is good practice to hold the same lock as the waiting thread
767 * while calling this function, though not required.
769 * This function can be used even if g_thread_init() has not yet been
770 * called, and, in that case, will do nothing.
773 g_cond_signal (GCond *cond)
777 if G_UNLIKELY ((status = pthread_cond_signal (&cond->impl)) != 0)
778 g_thread_abort (status, "pthread_cond_signal");
785 * If threads are waiting for @cond, all of them are unblocked.
786 * If no threads are waiting for @cond, this function has no effect.
787 * It is good practice to lock the same mutex as the waiting threads
788 * while calling this function, though not required.
790 * This function can be used even if g_thread_init() has not yet been
791 * called, and, in that case, will do nothing.
794 g_cond_broadcast (GCond *cond)
798 if G_UNLIKELY ((status = pthread_cond_broadcast (&cond->impl)) != 0)
799 g_thread_abort (status, "pthread_cond_broadcast");
805 * @mutex: a #GMutex that is currently locked
806 * @abs_time: a #GTimeVal, determining the final time
808 * Waits until this thread is woken up on @cond, but not longer than
809 * until the time specified by @abs_time. The @mutex is unlocked before
810 * falling asleep and locked again before resuming.
812 * If @abs_time is %NULL, g_cond_timed_wait() acts like g_cond_wait().
814 * This function can be used even if g_thread_init() has not yet been
815 * called, and, in that case, will immediately return %TRUE.
817 * To easily calculate @abs_time a combination of g_get_current_time()
818 * and g_time_val_add() can be used.
820 * Returns: %TRUE if @cond was signalled, or %FALSE on timeout
823 g_cond_timed_wait (GCond *cond,
827 struct timespec end_time;
830 if (abs_time == NULL)
832 g_cond_wait (cond, mutex);
836 end_time.tv_sec = abs_time->tv_sec;
837 end_time.tv_nsec = abs_time->tv_usec * 1000;
839 if ((status = pthread_cond_timedwait (&cond->impl, &mutex->impl, &end_time)) == 0)
842 if G_UNLIKELY (status != ETIMEDOUT)
843 g_thread_abort (status, "pthread_cond_timedwait");
851 * @mutex: a #GMutex that is currently locked
852 * @abs_time: the final time, in microseconds
854 * A variant of g_cond_timed_wait() that takes @abs_time
855 * as a #gint64 instead of a #GTimeVal.
856 * See g_cond_timed_wait() for details.
858 * Returns: %TRUE if @cond was signalled, or %FALSE on timeout
863 g_cond_timedwait (GCond *cond,
867 struct timespec end_time;
870 end_time.tv_sec = abs_time / 1000000;
871 end_time.tv_nsec = (abs_time % 1000000) * 1000;
873 if ((status = pthread_cond_timedwait (&cond->impl, &mutex->impl, &end_time)) == 0)
876 if G_UNLIKELY (status != ETIMEDOUT)
877 g_thread_abort (status, "pthread_cond_timedwait");
885 g_private_init (GPrivate *key,
886 GDestroyNotify notify)
888 pthread_key_create (&key->key, notify);
894 * @private_key: a #GPrivate
896 * Returns the pointer keyed to @private_key for the current thread. If
897 * g_private_set() hasn't been called for the current @private_key and
898 * thread yet, this pointer will be %NULL.
900 * This function can be used even if g_thread_init() has not yet been
901 * called, and, in that case, will return the value of @private_key
902 * casted to #gpointer. Note however, that private data set
903 * <emphasis>before</emphasis> g_thread_init() will
904 * <emphasis>not</emphasis> be retained <emphasis>after</emphasis> the
905 * call. Instead, %NULL will be returned in all threads directly after
906 * g_thread_init(), regardless of any g_private_set() calls issued
907 * before threading system initialization.
909 * Returns: the corresponding pointer
912 g_private_get (GPrivate *key)
915 return key->single_value;
917 /* quote POSIX: No errors are returned from pthread_getspecific(). */
918 return pthread_getspecific (key->key);
923 * @private_key: a #GPrivate
924 * @data: the new pointer
926 * Sets the pointer keyed to @private_key for the current thread.
928 * This function can be used even if g_thread_init() has not yet been
929 * called, and, in that case, will set @private_key to @data casted to
930 * #GPrivate*. See g_private_get() for resulting caveats.
933 g_private_set (GPrivate *key,
940 key->single_value = value;
944 if G_UNLIKELY ((status = pthread_setspecific (key->key, value)) != 0)
945 g_thread_abort (status, "pthread_setspecific");
951 #include "gthreadprivate.h"
956 #ifdef HAVE_SYS_TIME_H
957 # include <sys/time.h>
967 #define posix_check_err(err, name) G_STMT_START{ \
970 g_error ("file %s: line %d (%s): error '%s' during '%s'", \
971 __FILE__, __LINE__, G_STRFUNC, \
972 g_strerror (error), name); \
975 #define posix_check_cmd(cmd) posix_check_err (cmd, #cmd)
977 #define G_MUTEX_SIZE (sizeof (pthread_mutex_t))
980 g_system_thread_create (GThreadFunc thread_func,
990 g_return_if_fail (thread_func);
992 posix_check_cmd (pthread_attr_init (&attr));
994 #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
997 #ifdef _SC_THREAD_STACK_MIN
998 stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), stack_size);
999 #endif /* _SC_THREAD_STACK_MIN */
1000 /* No error check here, because some systems can't do it and
1001 * we simply don't want threads to fail because of that. */
1002 pthread_attr_setstacksize (&attr, stack_size);
1004 #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
1006 posix_check_cmd (pthread_attr_setdetachstate (&attr,
1007 joinable ? PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED));
1009 ret = pthread_create (thread, &attr, (void* (*)(void*))thread_func, arg);
1011 posix_check_cmd (pthread_attr_destroy (&attr));
1015 g_set_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN,
1016 "Error creating thread: %s", g_strerror (ret));
1020 posix_check_err (ret, "pthread_create");
1026 * Gives way to other threads waiting to be scheduled.
1028 * This function is often used as a method to make busy wait less evil.
1029 * But in most cases you will encounter, there are better methods to do
1030 * that. So in general you shouldn't use this function.
1033 g_thread_yield (void)
1039 g_system_thread_join (gpointer thread)
1042 posix_check_cmd (pthread_join (*(pthread_t*)thread, &ignore));
1046 g_system_thread_exit (void)
1048 pthread_exit (NULL);
1052 g_system_thread_self (gpointer thread)
1054 *(pthread_t*)thread = pthread_self();
1058 g_system_thread_equal (gpointer thread1,
1061 return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
1065 /* vim:set foldmethod=marker: */