pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:1:   /* -  * $Id: threads.h,v 1.104 2000/10/03 19:13:24 grubba Exp $ +  * $Id: threads.h,v 1.105 2000/10/26 01:34:51 hubbe Exp $    */   #ifndef THREADS_H   #define THREADS_H      #include "machine.h"   #include "object.h"   #include "error.h"   #include "interpret.h"      /* Needed for the sigset_t typedef, which is needed for
pike.git/src/threads.h:87:   #else   int th_atfork(void (*)(void),void (*)(void),void (*)(void));   void th_atfork_prepare(void);   void th_atfork_parent(void);   void th_atfork_child(void);   #endif      #define THREAD_T pthread_t   #define PIKE_MUTEX_T pthread_mutex_t   #define mt_init(X) pthread_mutex_init((X),0) +  + #if !defined(HAVE_PTHREAD_MUTEX_RECURSIVE_NP) && defined(HAVE_PTHREAD_MUTEX_RECURSIVE) + #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE + #define HAVE_PTHREAD_MUTEX_RECURSIVE_NP + #endif +  + #ifdef HAVE_PTHREAD_MUTEX_RECURSIVE_NP + #define mt_init_recursive(X) \ +  do{ \ +  pthread_mutexattr_t attr; \ +  pthread_mutexattr_init(&attr); \ +  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); \ +  pthread_mutex_init((X), &attr); \ +  }while(0) + #endif +    #define mt_lock(X) pthread_mutex_lock(X)   #define mt_trylock(X) pthread_mutex_trylock(X)   #define mt_unlock(X) pthread_mutex_unlock(X)   #define mt_destroy(X) pthread_mutex_destroy(X)      /* SIGH! No setconcurrency in posix threads. This is more or less    * needed to make usable multi-threaded programs on solaris machines    * with only one CPU. Otherwise, only systemcalls are actually    * threaded.    */
pike.git/src/threads.h:110:   #else   #define th_yield()   #endif /* HAVE_PTHREAD_YIELD */   extern pthread_attr_t pattr;   extern pthread_attr_t small_pattr;      #define th_create(ID,fun,arg) pthread_create(ID,&pattr,fun,arg)   #define th_create_small(ID,fun,arg) pthread_create(ID,&small_pattr,fun,arg)   #define th_exit(foo) pthread_exit(foo)   #define th_self() pthread_self() +  + #define TH_KEY_T pthread_key_t + #define th_key_create pthread_key_create + #define th_setspecific pthread_setspecific + #define th_getpecific pthread_getspecific +  +    #ifdef HAVE_PTHREAD_KILL   #define th_kill(ID,sig) pthread_kill((ID),(sig))   #else /* !HAVE_PTHREAD_KILL */   /* MacOS X (aka Darwin) doesn't have pthread_kill. */   #define th_kill(ID,sig)   #endif /* HAVE_PTHREAD_KILL */   #define th_join(ID,res) pthread_join((ID),(res))   #ifdef HAVE_PTHREAD_COND_INIT   #define COND_T pthread_cond_t