10 #include <win32thread.h>
11 #define PERL_THREAD_DETACH(t)
12 #define PERL_THREAD_SETSPECIFIC(k,v) TlsSetValue(k,v)
13 #define PERL_THREAD_GETSPECIFIC(k,v) v = TlsGetValue(k)
14 #define PERL_THREAD_ALLOC_SPECIFIC(k) \
16 if((k = TlsAlloc()) == TLS_OUT_OF_INDEXES) {\
17 PerlIO_printf(PerlIO_stderr(),"panic threads.h: TlsAlloc");\
25 #define PERL_THREAD_SETSPECIFIC(k,v) pthread_setspecific(k,v)
26 #ifdef OLD_PTHREADS_API
27 #define PERL_THREAD_DETACH(t) pthread_detach(&(t))
28 #define PERL_THREAD_GETSPECIFIC(k,v) pthread_getspecific(k,&v)
29 #define PERL_THREAD_ALLOC_SPECIFIC(k) STMT_START {\
30 if(pthread_keycreate(&(k),0)) {\
31 PerlIO_printf(PerlIO_stderr(), "panic threads.h: pthread_key_create");\
36 #define PERL_THREAD_DETACH(t) pthread_detach((t))
37 #define PERL_THREAD_GETSPECIFIC(k,v) v = pthread_getspecific(k)
38 #define PERL_THREAD_ALLOC_SPECIFIC(k) STMT_START {\
39 if(pthread_key_create(&(k),0)) {\
40 PerlIO_printf(PerlIO_stderr(), "panic threads.h: pthread_key_create");\
48 PerlInterpreter *interp; /* The threads interpreter */
49 I32 tid; /* Our thread */
50 perl_mutex mutex; /* our mutex */
51 I32 count; /* how many threads have a reference to us */
52 signed char detached; /* are we detached ? */
65 static perl_mutex create_mutex; /* protects the creation of threads ??? */
77 /* internal functions */
79 THREAD_RET_TYPE Perl_thread_run(LPVOID arg);
81 void* Perl_thread_run(void * arg);
83 void Perl_thread_destruct(ithread* thread);
85 /* Perl mapped functions to iThread:: */
86 SV* Perl_thread_create(char* class, SV* function_to_call, SV* params);
87 I32 Perl_thread_tid (SV* obj);
88 void Perl_thread_join(SV* obj);
89 void Perl_thread_detach(SV* obj);
90 SV* Perl_thread_self (char* class);