opcode.pl is chmod'ing the original source tree
[p5sagit/p5-mst-13.2.git] / thread.h
index 9740dba..4744aa0 100644 (file)
--- a/thread.h
+++ b/thread.h
@@ -1,5 +1,9 @@
 #if defined(USE_THREADS) || defined(USE_ITHREADS)
 
+#if defined(VMS)
+#include <builtins.h>
+#endif
+
 #ifdef WIN32
 #  include <win32thread.h>
 #else
 #      define pthread_mutexattr_init(a) pthread_mutexattr_create(a)
 #      define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t)
 #    endif
+#    if defined(__hpux) && defined(__ux_version) && __ux_version <= 1020
+#      define pthread_attr_init(a) pthread_attr_create(a)
+       /* XXX pthread_setdetach_np() missing in DCE threads on HP-UX 10.20 */
+#      define PTHREAD_ATTR_SETDETACHSTATE(a,s) (0)
+#      define PTHREAD_CREATE(t,a,s,d) pthread_create(t,a,s,d)
+#      define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d))
+#      define pthread_mutexattr_init(a) pthread_mutexattr_create(a)
+#      define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t)
+#    endif
 #    if defined(DJGPP) || defined(__OPEN_VM)
 #      define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_attr_setdetachstate(a,&(s))
 #      define YIELD pthread_yield(NULL)
 #    endif
 #  endif
+#  if !defined(__hpux) || !defined(__ux_version) || __ux_version > 1020
 #    define pthread_mutexattr_default NULL
 #    define pthread_condattr_default  NULL
+#  endif
 #endif
 
 #ifndef PTHREAD_CREATE
 #  endif
 #endif
 
+#ifdef DGUX
+#  define THREAD_CREATE_NEEDS_STACK (16*1024)
+#endif
+
 #ifdef I_MACH_CTHREADS
 
 /* cthreads interface */
     } STMT_END
 #endif /* JOIN */
 
+/* Use an unchecked fetch of thread-specific data instead of a checked one.
+ * It would fail if the key were bogus, but if the key were bogus then
+ * Really Bad Things would be happening anyway. --dan */
+#if (defined(__ALPHA) && (__VMS_VER >= 70000000)) || \
+    (defined(__alpha) && defined(__osf__)) /* Available only on >= 4.0 */
+#  define HAS_PTHREAD_UNCHECKED_GETSPECIFIC_NP /* Configure test needed */
+#endif
+
+#ifdef HAS_PTHREAD_UNCHECKED_GETSPECIFIC_NP
+#  define PTHREAD_GETSPECIFIC(key) pthread_unchecked_getspecific_np(key)
+#else
+#  define PTHREAD_GETSPECIFIC(key) pthread_getspecific(key)
+#endif
+
 #ifndef PERL_GET_CONTEXT
-#  define PERL_GET_CONTEXT     pthread_getspecific(PL_thr_key)
+#  define PERL_GET_CONTEXT     PTHREAD_GETSPECIFIC(PL_thr_key)
 #endif
 
 #ifndef PERL_SET_CONTEXT