jpl tweak
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index f9242e0..e5290f9 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -389,7 +389,7 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
 /* HP-UX 10.X CMA (Common Multithreaded Architecure) insists that
    pthread.h must be included before all other header files.
 */
-#if defined(USE_THREADS) && defined(PTHREAD_H_FIRST)
+#if defined(USE_THREADS) && defined(PTHREAD_H_FIRST) && defined(I_PTHREAD)
 #  include <pthread.h>
 #endif
 
@@ -1046,16 +1046,16 @@ Free_t   Perl_mfree (Malloc_t where);
 #define IV_DIG (BIT_DIGITS(IVSIZE * 8))
 #define UV_DIG (BIT_DIGITS(IVSIZE * 8))
 
-+ /*   
-+  *  The macros INT2PTR and NUM2PTR are (despite their names)
-+  *  bi-directional: they will convert int/float to or from pointers.
-+  *  However the conversion to int/float are named explicitly:
-+  *  PTR2IV, PTR2UV, PTR2NV.
-+  *
-+  *  For int conversions we do not need two casts if pointers are
-+  *  the same size as IV and UV.   Otherwise we need an explicit
-+  *  cast (PTRV) to avoid compiler warnings.
-+  */
+/*   
+ *  The macros INT2PTR and NUM2PTR are (despite their names)
+ *  bi-directional: they will convert int/float to or from pointers.
+ *  However the conversion to int/float are named explicitly:
+ *  PTR2IV, PTR2UV, PTR2NV.
+ *
+ *  For int conversions we do not need two casts if pointers are
+ *  the same size as IV and UV.   Otherwise we need an explicit
+ *  cast (PTRV) to avoid compiler warnings.
+ */
 #if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
 #  define PTRV                 UV
 #  define INT2PTR(any,d)       (any)(d)
@@ -1616,7 +1616,9 @@ typedef mutex_t           perl_mutex;
 typedef condition_t    perl_cond;
 typedef void *         perl_key;
 #        else /* Posix threads */
-#          include <pthread.h>
+#          ifdef I_PTHREAD
+#            include <pthread.h>
+#          endif
 typedef pthread_t      perl_os_thread;
 typedef pthread_mutex_t        perl_mutex;
 typedef pthread_cond_t perl_cond;
@@ -1728,6 +1730,22 @@ typedef pthread_key_t    perl_key;
 #  endif
 #endif
 
+#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_GET_THX)
+#  ifdef USE_THREADS
+#    define PERL_GET_THX               THR
+#  else
+#  ifdef MULTIPLICITY
+#    define PERL_GET_THX               PERL_GET_INTERP
+#  else
+#  ifdef PERL_OBJECT
+#    define PERL_GET_THX               ((CPerlObj*)PERL_GET_INTERP)
+#  else
+#    define PERL_GET_THX               ((void*)0)
+#  endif
+#  endif
+#  endif
+#endif
+
 /* Some unistd.h's give a prototype for pause() even though
    HAS_PAUSE ends up undefined.  This causes the #define
    below to be rejected by the compmiler.  Sigh.