diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1998-10-20 15:01:20 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1998-10-20 15:01:20 +0000 |
commit | 0d85d8777a6ec9fdcc93593180474ebff6fbbccb (patch) | |
tree | b7a90ec24c4eeb104282c17fe156d049c6fbbf70 /thread.h | |
parent | fe572743bdc94988ae47d8a129c5f974e72052a1 (diff) | |
download | perl-0d85d8777a6ec9fdcc93593180474ebff6fbbccb.tar.gz |
OLD_PTHREADS_API reorganizing.
p4raw-id: //depot/cfgperl@2028
Diffstat (limited to 'thread.h')
-rw-r--r-- | thread.h | 61 |
1 files changed, 43 insertions, 18 deletions
@@ -3,14 +3,7 @@ #ifdef WIN32 # include <win32thread.h> #else -/* XXX What we really need is Configure probing for all of these - * pthread thingies, old, medium, and new, not the blanket statement of - * OLD_PTHREADS_API. --jhi */ -# if defined(OLD_PTHREADS_API) && !defined(DJGPP) && !defined(__OPEN_VM) && !defined(OEMVS) - /* POSIXish threads */ -# define pthread_mutexattr_init(a) pthread_mutexattr_create(a) -# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t) -# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d)) +# ifdef OLD_PTHREADS_API /* Here be dragons. */ # define DETACH(t) \ STMT_START { \ if (pthread_detach(&(t)->self)) { \ @@ -18,10 +11,47 @@ croak("panic: DETACH"); \ } \ } STMT_END -# else +# define THR getTHR +struct perl_thread *getTHR _((void)); +# define PTHREAD_GETSPECIFIC_INT +# ifdef DJGPP +# define pthread_addr_t any_t +# define NEED_PTHREAD_INIT +# define PTHREAD_CREATE_JOINABLE (&err) +# endif +# ifdef __OPEN_VM +# define pthread_addr_t void * +# endif +# ifdef VMS +# define pthread_attr_init(a) pthread_attr_create(a) +# define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_setdetach_np(a,s) +# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d)) +# define pthread_mutexattr_init(a) pthread_mutexattr_create(a) +# endif +# if defined(DJGPP) || defined(__OPEN_VM) +# define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_attr_setdetachstate(a,&(s)) +# define YIELD pthread_yield(NULL) +# endif +# if defined(DJGPP) || defined(VMS) +# define PTHREAD_CREATE(t,a,s,d) pthread_create(t,a,s,d) +# endif +# if defined(__OPEN_VM) || defined(VMS) +# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t) +# endif +# endif +# ifndef VMS # define pthread_mutexattr_default NULL -# define pthread_condattr_default NULL -# endif /* OLD_PTHREADS_API */ +# define pthread_condattr_default NULL +# endif +#endif + +#ifndef PTHREAD_CREATE +/* You are not supposed to pass NULL as the 2nd arg of PTHREAD_CREATE(). */ +# define PTHREAD_CREATE(t,a,s,d) pthread_create(t,&(a),s,d) +#endif + +#ifndef PTHREAD_ATTR_SETDETACHSTATE +# define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_attr_setdetachstate(a,s) #endif #ifndef YIELD @@ -131,13 +161,8 @@ #endif /* SET_THR */ #ifndef THR -# ifdef OLD_PTHREADS_API -struct perl_thread *getTHR _((void)); -# define THR getTHR() -# else -# define THR ((struct perl_thread *) pthread_getspecific(PL_thr_key)) -# endif /* OLD_PTHREADS_API */ -#endif /* THR */ +#define THR ((struct perl_thread *) pthread_getspecific(PL_thr_key)) +#endif /* * dTHR is performance-critical. Here, we only do the pthread_get_specific |