diff options
author | Bruno Haible <bruno@clisp.org> | 2019-07-06 03:56:55 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-07-06 03:56:55 +0200 |
commit | 7ce5f5c77f679f0da1fa15f4fb7c9e103685d079 (patch) | |
tree | 9238e7a79602a5afbb2b0dd3b02fbe071e6994f2 /lib/glthread | |
parent | e58796ff7110de26254fc06afdff21461462be72 (diff) | |
download | gnulib-7ce5f5c77f679f0da1fa15f4fb7c9e103685d079.tar.gz |
thread, lock, cond, tls: Remove support for Pth threads.
* m4/threadlib.m4 (gl_THREADLIB_EARLY_BODY): Don't document
--enable-threads=pth any more.
(gl_THREADLIB_BODY): Don't set USE_PTH_THREADS any more.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Update comment.
* m4/threads.m4 (gl_THREADS_H): Remove test for conflict between Pth
threads and ISO C11 threads.
* lib/glthread/thread.h: Remove code for USE_PTH_THREADS.
* lib/glthread/lock.h: Likewise.
* lib/glthread/lock.c: Likewise.
* lib/glthread/cond.h: Likewise.
* lib/glthread/cond.c: Likewise.
* lib/glthread/tls.h: Likewise.
* lib/glthread/tls.c: Likewise.
* lib/glthread/yield.h: Likewise.
* lib/regex_internal.h: Likewise.
* tests/test-thread_create.c: Likewise.
* tests/test-lock.c: Likewise.
* tests/test-cond.c: Likewise.
* tests/test-tls.c: Likewise.
* tests/test-rwlock1.c: Don't include glthread/yield.h.
(main): Sleep without calling gl_thread_yield.
Diffstat (limited to 'lib/glthread')
-rw-r--r-- | lib/glthread/cond.c | 28 | ||||
-rw-r--r-- | lib/glthread/cond.h | 63 | ||||
-rw-r--r-- | lib/glthread/lock.c | 180 | ||||
-rw-r--r-- | lib/glthread/lock.h | 154 | ||||
-rw-r--r-- | lib/glthread/thread.h | 58 | ||||
-rw-r--r-- | lib/glthread/tls.c | 6 | ||||
-rw-r--r-- | lib/glthread/tls.h | 57 | ||||
-rw-r--r-- | lib/glthread/yield.h | 23 |
8 files changed, 9 insertions, 560 deletions
diff --git a/lib/glthread/cond.c b/lib/glthread/cond.c index 72aeca4a32..f6a06cc9fa 100644 --- a/lib/glthread/cond.c +++ b/lib/glthread/cond.c @@ -24,34 +24,6 @@ /* ========================================================================= */ -#if USE_PTH_THREADS - -/* -------------------------- gl_cond_t datatype -------------------------- */ - -int -glthread_cond_timedwait_multithreaded (gl_cond_t *cond, - gl_lock_t *lock, - struct timespec *abstime) -{ - int ret, status; - pth_event_t ev; - - ev = pth_event (PTH_EVENT_TIME, pth_time (abstime->tv_sec, abstime->tv_nsec / 1000)); - ret = pth_cond_await (cond, lock, ev); - - status = pth_event_status (ev); - pth_event_free (ev, PTH_FREE_THIS); - - if (status == PTH_STATUS_OCCURRED) - return ETIMEDOUT; - - return ret; -} - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS #endif diff --git a/lib/glthread/cond.h b/lib/glthread/cond.h index b03ffe300c..4c6f4d94c0 100644 --- a/lib/glthread/cond.h +++ b/lib/glthread/cond.h @@ -56,7 +56,7 @@ #include "glthread/lock.h" #if !defined c11_threads_in_use -# if HAVE_THREADS_H && (USE_POSIX_THREADS_WEAK || USE_PTH_THREADS_WEAK) +# if HAVE_THREADS_H && USE_POSIX_THREADS_WEAK # include <threads.h> # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) @@ -168,65 +168,6 @@ typedef pthread_cond_t gl_cond_t; /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -# include <pth.h> - -# ifdef __cplusplus -extern "C" { -# endif - -# if USE_PTH_THREADS_WEAK - -/* Use weak references to the GNU Pth threads library. */ - -# pragma weak pth_cond_init -# pragma weak pth_cond_await -# pragma weak pth_cond_notify -# pragma weak pth_event -# pragma weak pth_timeout - -# pragma weak pth_cancel -# define pth_in_use() (pth_cancel != NULL || c11_threads_in_use ()) - -# else - -# define pth_in_use() 1 - -# endif - -/* -------------------------- gl_cond_t datatype -------------------------- */ - -typedef pth_cond_t gl_cond_t; -# define gl_cond_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_cond_t NAME; -# define gl_cond_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS gl_cond_t NAME = gl_cond_initializer; -# define gl_cond_initializer \ - PTH_COND_INIT -# define glthread_cond_init(COND) \ - (pth_in_use () && !pth_cond_init (COND) ? errno : 0) -# define glthread_cond_wait(COND, LOCK) \ - (pth_in_use () && !pth_cond_await (COND, LOCK, NULL) ? errno : 0) -# define glthread_cond_timedwait(COND, LOCK, ABSTIME) \ - (pth_in_use () ? glthread_cond_timedwait_multithreaded (COND, LOCK, ABSTIME) : 0) -# define glthread_cond_signal(COND) \ - (pth_in_use () && !pth_cond_notify (COND, FALSE) ? errno : 0) -# define glthread_cond_broadcast(COND) \ - (pth_in_use () && !pth_cond_notify (COND, TRUE) ? errno : 0) -# define glthread_cond_destroy(COND) 0 -extern int glthread_cond_timedwait_multithreaded (gl_cond_t *cond, gl_lock_t *lock, struct timespec *abstime); - -# ifdef __cplusplus -} -# endif - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ @@ -273,7 +214,7 @@ typedef glwthread_cond_t gl_cond_t; /* ========================================================================= */ -#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS) +#if !(USE_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c index e7fa3f8961..89f1f50ab1 100644 --- a/lib/glthread/lock.c +++ b/lib/glthread/lock.c @@ -499,186 +499,6 @@ glthread_once_singlethreaded (pthread_once_t *once_control) /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -/* -------------------------- gl_lock_t datatype -------------------------- */ - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -# if !HAVE_PTH_RWLOCK_ACQUIRE_PREFER_WRITER - -int -glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) -{ - if (!pth_mutex_init (&lock->lock)) - return errno; - if (!pth_cond_init (&lock->waiting_readers)) - return errno; - if (!pth_cond_init (&lock->waiting_writers)) - return errno; - lock->waiting_writers_count = 0; - lock->runcount = 0; - lock->initialized = 1; - return 0; -} - -int -glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) -{ - if (!lock->initialized) - glthread_rwlock_init_multithreaded (lock); - if (!pth_mutex_acquire (&lock->lock, 0, NULL)) - return errno; - /* Test whether only readers are currently running, and whether the runcount - field will not overflow, and whether no writer is waiting. The latter - condition is because POSIX recommends that "write locks shall take - precedence over read locks", to avoid "writer starvation". */ - while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) - { - /* This thread has to wait for a while. Enqueue it among the - waiting_readers. */ - if (!pth_cond_await (&lock->waiting_readers, &lock->lock, NULL)) - { - int err = errno; - pth_mutex_release (&lock->lock); - return err; - } - } - lock->runcount++; - return (!pth_mutex_release (&lock->lock) ? errno : 0); -} - -int -glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) -{ - if (!lock->initialized) - glthread_rwlock_init_multithreaded (lock); - if (!pth_mutex_acquire (&lock->lock, 0, NULL)) - return errno; - /* Test whether no readers or writers are currently running. */ - while (!(lock->runcount == 0)) - { - /* This thread has to wait for a while. Enqueue it among the - waiting_writers. */ - lock->waiting_writers_count++; - if (!pth_cond_await (&lock->waiting_writers, &lock->lock, NULL)) - { - int err = errno; - lock->waiting_writers_count--; - pth_mutex_release (&lock->lock); - return err; - } - lock->waiting_writers_count--; - } - lock->runcount--; /* runcount becomes -1 */ - return (!pth_mutex_release (&lock->lock) ? errno : 0); -} - -int -glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) -{ - int err; - - if (!lock->initialized) - return EINVAL; - if (!pth_mutex_acquire (&lock->lock, 0, NULL)) - return errno; - if (lock->runcount < 0) - { - /* Drop a writer lock. */ - if (!(lock->runcount == -1)) - { - pth_mutex_release (&lock->lock); - return EINVAL; - } - lock->runcount = 0; - } - else - { - /* Drop a reader lock. */ - if (!(lock->runcount > 0)) - { - pth_mutex_release (&lock->lock); - return EINVAL; - } - lock->runcount--; - } - if (lock->runcount == 0) - { - /* POSIX recommends that "write locks shall take precedence over read - locks", to avoid "writer starvation". */ - if (lock->waiting_writers_count > 0) - { - /* Wake up one of the waiting writers. */ - if (!pth_cond_notify (&lock->waiting_writers, FALSE)) - { - int err = errno; - pth_mutex_release (&lock->lock); - return err; - } - } - else - { - /* Wake up all waiting readers. */ - if (!pth_cond_notify (&lock->waiting_readers, TRUE)) - { - int err = errno; - pth_mutex_release (&lock->lock); - return err; - } - } - } - return (!pth_mutex_release (&lock->lock) ? errno : 0); -} - -int -glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) -{ - lock->initialized = 0; - return 0; -} - -# endif - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -/* -------------------------- gl_once_t datatype -------------------------- */ - -static void -glthread_once_call (void *arg) -{ - void (**gl_once_temp_addr) (void) = (void (**) (void)) arg; - void (*initfunction) (void) = *gl_once_temp_addr; - initfunction (); -} - -int -glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void)) -{ - void (*temp) (void) = initfunction; - return (!pth_once (once_control, glthread_once_call, &temp) ? errno : 0); -} - -int -glthread_once_singlethreaded (pth_once_t *once_control) -{ - /* We know that pth_once_t is an integer type. */ - if (*once_control == PTH_ONCE_INIT) - { - /* First time use of once_control. Invert the marker. */ - *once_control = ~ PTH_ONCE_INIT; - return 1; - } - else - return 0; -} - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS /* ------------------------- gl_rwlock_t datatype ------------------------- */ diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h index 2db8b7ecab..bc3a4def38 100644 --- a/lib/glthread/lock.h +++ b/lib/glthread/lock.h @@ -81,7 +81,7 @@ #include <stdlib.h> #if !defined c11_threads_in_use -# if HAVE_THREADS_H && (USE_POSIX_THREADS_WEAK || USE_PTH_THREADS_WEAK) +# if HAVE_THREADS_H && USE_POSIX_THREADS_WEAK # include <threads.h> # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) @@ -405,156 +405,6 @@ extern int glthread_once_singlethreaded (pthread_once_t *once_control); /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -# include <pth.h> - -# ifdef __cplusplus -extern "C" { -# endif - -# if USE_PTH_THREADS_WEAK - -/* Use weak references to the GNU Pth threads library. */ - -# pragma weak pth_mutex_init -# pragma weak pth_mutex_acquire -# pragma weak pth_mutex_release -# pragma weak pth_rwlock_init -# pragma weak pth_rwlock_acquire -# pragma weak pth_rwlock_release -# pragma weak pth_once -# pragma weak pth_cond_init -# pragma weak pth_cond_await -# pragma weak pth_cond_notify - -# pragma weak pth_cancel -# define pth_in_use() (pth_cancel != NULL || c11_threads_in_use ()) - -# else - -# define pth_in_use() 1 - -# endif - -/* -------------------------- gl_lock_t datatype -------------------------- */ - -typedef pth_mutex_t gl_lock_t; -# define gl_lock_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME; -# define gl_lock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME = gl_lock_initializer; -# define gl_lock_initializer \ - PTH_MUTEX_INIT -# define glthread_lock_init(LOCK) \ - (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0) -# define glthread_lock_lock(LOCK) \ - (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0) -# define glthread_lock_unlock(LOCK) \ - (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0) -# define glthread_lock_destroy(LOCK) \ - ((void)(LOCK), 0) - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -/* Pth pth_rwlock_acquire always prefers readers. No autoconf test so far. */ -# if HAVE_PTH_RWLOCK_ACQUIRE_PREFER_WRITER - -typedef pth_rwlock_t gl_rwlock_t; -# define gl_rwlock_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_rwlock_t NAME; -# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer; -# define gl_rwlock_initializer \ - PTH_RWLOCK_INIT -# define glthread_rwlock_init(LOCK) \ - (pth_in_use () && !pth_rwlock_init (LOCK) ? errno : 0) -# define glthread_rwlock_rdlock(LOCK) \ - (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RD, 0, NULL) ? errno : 0) -# define glthread_rwlock_wrlock(LOCK) \ - (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RW, 0, NULL) ? errno : 0) -# define glthread_rwlock_unlock(LOCK) \ - (pth_in_use () && !pth_rwlock_release (LOCK) ? errno : 0) -# define glthread_rwlock_destroy(LOCK) \ - ((void)(LOCK), 0) - -# else - -typedef struct - { - int initialized; - pth_mutex_t lock; /* protects the remaining fields */ - pth_cond_t waiting_readers; /* waiting readers */ - pth_cond_t waiting_writers; /* waiting writers */ - unsigned int waiting_writers_count; /* number of waiting writers */ - int runcount; /* number of readers running, or -1 when a writer runs */ - } - gl_rwlock_t; -# define gl_rwlock_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_rwlock_t NAME; -# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; -# define gl_rwlock_initializer \ - { 0 } -# define glthread_rwlock_init(LOCK) \ - (pth_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) -# define glthread_rwlock_rdlock(LOCK) \ - (pth_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) -# define glthread_rwlock_wrlock(LOCK) \ - (pth_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) -# define glthread_rwlock_unlock(LOCK) \ - (pth_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) -# define glthread_rwlock_destroy(LOCK) \ - (pth_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) -extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); -extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); -extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); -extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); -extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); - -# endif - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -/* In Pth, mutexes are recursive by default. */ -typedef pth_mutex_t gl_recursive_lock_t; -# define gl_recursive_lock_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME; -# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer; -# define gl_recursive_lock_initializer \ - PTH_MUTEX_INIT -# define glthread_recursive_lock_init(LOCK) \ - (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0) -# define glthread_recursive_lock_lock(LOCK) \ - (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0) -# define glthread_recursive_lock_unlock(LOCK) \ - (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0) -# define glthread_recursive_lock_destroy(LOCK) \ - ((void)(LOCK), 0) - -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef pth_once_t gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT; -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (pth_in_use () \ - ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ - : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) -extern int glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void)); -extern int glthread_once_singlethreaded (pth_once_t *once_control); - -# ifdef __cplusplus -} -# endif - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ @@ -677,7 +527,7 @@ typedef glwthread_once_t gl_once_t; /* ========================================================================= */ -#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS) +#if !(USE_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index eed2eb6e9c..eef9a46aff 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -74,7 +74,7 @@ #include <stdlib.h> #if !defined c11_threads_in_use -# if HAVE_THREADS_H && (USE_POSIX_THREADS_WEAK || USE_PTH_THREADS_WEAK) +# if HAVE_THREADS_H && USE_POSIX_THREADS_WEAK # include <threads.h> # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) @@ -222,60 +222,6 @@ extern const gl_thread_t gl_null_thread; /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -# include <pth.h> - -# ifdef __cplusplus -extern "C" { -# endif - -# if USE_PTH_THREADS_WEAK - -/* Use weak references to the GNU Pth threads library. */ - -# pragma weak pth_init -# pragma weak pth_spawn -# pragma weak pth_sigmask -# pragma weak pth_join -# pragma weak pth_self -# pragma weak pth_exit - -# pragma weak pth_cancel -# define pth_in_use() (pth_cancel != NULL || c11_threads_in_use ()) - -# else - -# define pth_in_use() 1 - -# endif -/* -------------------------- gl_thread_t datatype -------------------------- */ - -typedef pth_t gl_thread_t; -# define glthread_create(THREADP, FUNC, ARG) \ - (pth_in_use () ? (pth_init (), ((*(THREADP) = pth_spawn (NULL, FUNC, ARG)) ? 0 : errno)) : 0) -# define glthread_sigmask(HOW, SET, OSET) \ - (pth_in_use () ? (pth_init (), (pth_sigmask (HOW, SET, OSET) ? 0 : errno)) : 0) -# define glthread_join(THREAD, RETVALP) \ - (pth_in_use () ? (pth_init (), (pth_join (THREAD, RETVALP) ? 0 : errno)) : 0) -# define gl_thread_self() \ - (pth_in_use () ? (pth_init (), (void *) pth_self ()) : NULL) -# define gl_thread_self_pointer() \ - gl_thread_self () -# define gl_thread_exit(RETVAL) \ - (pth_in_use () ? (pth_init (), pth_exit (RETVAL)) : 0) -# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 - -# ifdef __cplusplus -} -# endif - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ @@ -312,7 +258,7 @@ typedef glwthread_thread_t gl_thread_t; /* ========================================================================= */ -#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS) +#if !(USE_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ diff --git a/lib/glthread/tls.c b/lib/glthread/tls.c index cc6d4e1b4a..d182266c56 100644 --- a/lib/glthread/tls.c +++ b/lib/glthread/tls.c @@ -28,12 +28,6 @@ /* ========================================================================= */ -#if USE_PTH_THREADS - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS #endif diff --git a/lib/glthread/tls.h b/lib/glthread/tls.h index a86dcd46ec..cfc96061c1 100644 --- a/lib/glthread/tls.h +++ b/lib/glthread/tls.h @@ -47,7 +47,7 @@ #include <stdlib.h> #if !defined c11_threads_in_use -# if HAVE_THREADS_H && (USE_POSIX_THREADS_WEAK || USE_PTH_THREADS_WEAK) +# if HAVE_THREADS_H && USE_POSIX_THREADS_WEAK # include <threads.h> # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) @@ -126,59 +126,6 @@ typedef union /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -# include <pth.h> - -# if USE_PTH_THREADS_WEAK - -/* Use weak references to the GNU Pth threads library. */ - -# pragma weak pth_key_create -# pragma weak pth_key_getdata -# pragma weak pth_key_setdata -# pragma weak pth_key_delete - -# pragma weak pth_cancel -# define pth_in_use() (pth_cancel != NULL || c11_threads_in_use ()) - -# else - -# define pth_in_use() 1 - -# endif - -/* ------------------------- gl_tls_key_t datatype ------------------------- */ - -typedef union - { - void *singlethread_value; - pth_key_t key; - } - gl_tls_key_t; -# define glthread_tls_key_init(KEY, DESTRUCTOR) \ - (pth_in_use () \ - ? (!pth_key_create (&(KEY)->key, DESTRUCTOR) ? errno : 0) \ - : ((KEY)->singlethread_value = NULL, 0)) -# define gl_tls_get(NAME) \ - (pth_in_use () \ - ? pth_key_getdata ((NAME).key) \ - : (NAME).singlethread_value) -# define glthread_tls_set(KEY, POINTER) \ - (pth_in_use () \ - ? (!pth_key_setdata ((KEY)->key, (POINTER)) ? errno : 0) \ - : ((KEY)->singlethread_value = (POINTER), 0)) -# define glthread_tls_key_destroy(KEY) \ - (pth_in_use () \ - ? (!pth_key_delete ((KEY)->key) ? errno : 0) \ - : 0) - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ @@ -202,7 +149,7 @@ typedef glwthread_tls_key_t gl_tls_key_t; /* ========================================================================= */ -#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS) +#if !(USE_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ diff --git a/lib/glthread/yield.h b/lib/glthread/yield.h index 3a2877b1a5..27bca55b79 100644 --- a/lib/glthread/yield.h +++ b/lib/glthread/yield.h @@ -46,27 +46,6 @@ extern "C" { /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -# include <pth.h> - -# ifdef __cplusplus -extern "C" { -# endif - -# define gl_thread_yield() \ - pth_yield (NULL) - -# ifdef __cplusplus -} -# endif - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ @@ -87,7 +66,7 @@ extern "C" { /* ========================================================================= */ -#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS) +#if !(USE_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ |