As suggested by Arthur: the threads and threads::shared
[p5sagit/p5-mst-13.2.git] / ext / threads / threads.xs
index 393867e..db76082 100755 (executable)
@@ -3,6 +3,8 @@
 #include "perl.h"
 #include "XSUB.h"
 
+#ifdef USE_ITHREADS
+
 #ifdef WIN32
 #include <windows.h>
 #include <win32thread.h>
@@ -120,7 +122,6 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why)
        MUTEX_UNLOCK(&create_destruct_mutex);
        /* Thread is now disowned */
        if (thread->interp) {
-           dTHXa(thread->interp);
            PERL_SET_CONTEXT(thread->interp);
            perl_destruct(thread->interp);
            perl_free(thread->interp);
@@ -407,7 +408,6 @@ Perl_ithread_create(pTHX_ SV *obj, char* classname, SV* init_function, SV* param
        {
          static pthread_attr_t attr;
          static int attr_inited = 0;
-         sigset_t fullmask, oldmask;
          static int attr_joinable = PTHREAD_CREATE_JOINABLE;
          if (!attr_inited) {
            attr_inited = 1;
@@ -518,11 +518,13 @@ Perl_ithread_DESTROY(pTHX_ SV *sv)
     sv_unmagic(SvRV(sv),PERL_MAGIC_shared_scalar);
 }
 
-
+#endif /* USE_ITHREADS */
 
 MODULE = threads               PACKAGE = threads       PREFIX = ithread_
 PROTOTYPES: DISABLE
 
+#ifdef USE_ITHREADS
+
 void
 ithread_new (classname, function_to_call, ...)
 char * classname
@@ -571,8 +573,11 @@ ithread_detach(ithread *thread)
 void
 ithread_DESTROY(SV *thread)
 
+#endif /* USE_ITHREADS */
+
 BOOT:
 {
+#ifdef USE_ITHREADS
        ithread* thread;
        PL_perl_destruct_level = 2;
        PERL_THREAD_ALLOC_SPECIFIC(self_key);
@@ -600,5 +605,6 @@ BOOT:
 
        PERL_THREAD_SETSPECIFIC(self_key,thread);
        MUTEX_UNLOCK(&create_destruct_mutex);
+#endif /* USE_ITHREADS */
 }