|
@ -35,23 +35,23 @@ typedef int ssize_t; |
|
|
#define sigemptyset(s) |
|
|
#define sigemptyset(s) |
|
|
#define sigfillset(s) |
|
|
#define sigfillset(s) |
|
|
|
|
|
|
|
|
typedef pthread_mutex_t mutex_t; |
|
|
typedef pthread_mutex_t xmutex_t; |
|
|
#define X_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER |
|
|
#define X_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER |
|
|
#define X_LOCK(mutex) pthread_mutex_lock (&(mutex)) |
|
|
#define X_LOCK(mutex) pthread_mutex_lock (&(mutex)) |
|
|
#define X_UNLOCK(mutex) pthread_mutex_unlock (&(mutex)) |
|
|
#define X_UNLOCK(mutex) pthread_mutex_unlock (&(mutex)) |
|
|
|
|
|
|
|
|
typedef pthread_cond_t cond_t; |
|
|
typedef pthread_cond_t xcond_t; |
|
|
#define X_COND_INIT PTHREAD_COND_INITIALIZER |
|
|
#define X_COND_INIT PTHREAD_COND_INITIALIZER |
|
|
#define X_COND_SIGNAL(cond) pthread_cond_signal (&(cond)) |
|
|
#define X_COND_SIGNAL(cond) pthread_cond_signal (&(cond)) |
|
|
#define X_COND_WAIT(cond,mutex) pthread_cond_wait (&(cond), &(mutex)) |
|
|
#define X_COND_WAIT(cond,mutex) pthread_cond_wait (&(cond), &(mutex)) |
|
|
#define X_COND_TIMEDWAIT(cond,mutex,to) pthread_cond_timedwait (&(cond), &(mutex), &(to)) |
|
|
#define X_COND_TIMEDWAIT(cond,mutex,to) pthread_cond_timedwait (&(cond), &(mutex), &(to)) |
|
|
|
|
|
|
|
|
typedef pthread_t thread_t; |
|
|
typedef pthread_t xthread_t; |
|
|
#define X_THREAD_PROC(name) void *name (void *thr_arg) |
|
|
#define X_THREAD_PROC(name) void *name (void *thr_arg) |
|
|
#define X_THREAD_ATFORK(a,b,c) |
|
|
#define X_THREAD_ATFORK(a,b,c) |
|
|
|
|
|
|
|
|
static int |
|
|
static int |
|
|
thread_create (thread_t *tid, void *(*proc)(void *), void *arg) |
|
|
thread_create (xthread_t *tid, void *(*proc)(void *), void *arg) |
|
|
{ |
|
|
{ |
|
|
int retval; |
|
|
int retval; |
|
|
pthread_attr_t attr; |
|
|
pthread_attr_t attr; |
|
@ -94,7 +94,7 @@ thread_create (thread_t *tid, void *(*proc)(void *), void *arg) |
|
|
#include <limits.h> |
|
|
#include <limits.h> |
|
|
#include <pthread.h> |
|
|
#include <pthread.h> |
|
|
|
|
|
|
|
|
typedef pthread_mutex_t mutex_t; |
|
|
typedef pthread_mutex_t xmutex_t; |
|
|
#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
|
|
#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
|
|
# define X_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
|
|
# define X_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
|
|
#else |
|
|
#else |
|
@ -103,13 +103,13 @@ typedef pthread_mutex_t mutex_t; |
|
|
#define X_LOCK(mutex) pthread_mutex_lock (&(mutex)) |
|
|
#define X_LOCK(mutex) pthread_mutex_lock (&(mutex)) |
|
|
#define X_UNLOCK(mutex) pthread_mutex_unlock (&(mutex)) |
|
|
#define X_UNLOCK(mutex) pthread_mutex_unlock (&(mutex)) |
|
|
|
|
|
|
|
|
typedef pthread_cond_t cond_t; |
|
|
typedef pthread_cond_t xcond_t; |
|
|
#define X_COND_INIT PTHREAD_COND_INITIALIZER |
|
|
#define X_COND_INIT PTHREAD_COND_INITIALIZER |
|
|
#define X_COND_SIGNAL(cond) pthread_cond_signal (&(cond)) |
|
|
#define X_COND_SIGNAL(cond) pthread_cond_signal (&(cond)) |
|
|
#define X_COND_WAIT(cond,mutex) pthread_cond_wait (&(cond), &(mutex)) |
|
|
#define X_COND_WAIT(cond,mutex) pthread_cond_wait (&(cond), &(mutex)) |
|
|
#define X_COND_TIMEDWAIT(cond,mutex,to) pthread_cond_timedwait (&(cond), &(mutex), &(to)) |
|
|
#define X_COND_TIMEDWAIT(cond,mutex,to) pthread_cond_timedwait (&(cond), &(mutex), &(to)) |
|
|
|
|
|
|
|
|
typedef pthread_t thread_t; |
|
|
typedef pthread_t xthread_t; |
|
|
#define X_THREAD_PROC(name) static void *name (void *thr_arg) |
|
|
#define X_THREAD_PROC(name) static void *name (void *thr_arg) |
|
|
#define X_THREAD_ATFORK(prepare,parent,child) pthread_atfork (prepare, parent, child) |
|
|
#define X_THREAD_ATFORK(prepare,parent,child) pthread_atfork (prepare, parent, child) |
|
|
|
|
|
|
|
@ -123,7 +123,7 @@ typedef pthread_t thread_t; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
static int |
|
|
static int |
|
|
thread_create (thread_t *tid, void *(*proc)(void *), void *arg) |
|
|
thread_create (xthread_t *tid, void *(*proc)(void *), void *arg) |
|
|
{ |
|
|
{ |
|
|
int retval; |
|
|
int retval; |
|
|
sigset_t fullsigset, oldsigset; |
|
|
sigset_t fullsigset, oldsigset; |
|
|