summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-05-17 14:21:08 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-17 14:21:08 +0000
commit8b8b35abf0ac836d99804d38380d3c236b12c28e (patch)
tree8398b401d276da300af959ff89349ada6056181d
parent0953243c2ac89e79fe3d39c48a15619486aafea4 (diff)
downloadperl-8b8b35abf0ac836d99804d38380d3c236b12c28e.tar.gz
Macrofy the getspecific (and use it also in util.c)
p4raw-id: //depot/perl@10143
-rw-r--r--thread.h19
-rw-r--r--util.c10
2 files changed, 16 insertions, 13 deletions
diff --git a/thread.h b/thread.h
index 912288587e..b14907abd3 100644
--- a/thread.h
+++ b/thread.h
@@ -249,15 +249,22 @@
} STMT_END
#endif /* JOIN */
-#ifndef PERL_GET_CONTEXT
-# if (defined(__ALPHA) && (__VMS_VER >= 70000000)) || (defined(__alpha) && defined(__osf__))
/* 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 */
-# define PERL_GET_CONTEXT pthread_unchecked_getspecific_np(PL_thr_key)
-# else
-# define PERL_GET_CONTEXT pthread_getspecific(PL_thr_key)
-# endif
+#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)
#endif
#ifndef PERL_SET_CONTEXT
diff --git a/util.c b/util.c
index 848a61e9ad..12c5f0ddc0 100644
--- a/util.c
+++ b/util.c
@@ -3490,14 +3490,10 @@ Perl_get_context(void)
return (void*)t;
# else
# ifdef I_MACH_CTHREADS
- return (void*)cthread_data(cthread_self());
+ return (void*)cthread_data(cthread_self());
# else
-# if defined(__ALPHA) && (__VMS_VER >= 70000000)
- return (void*)pthread_unchecked_getspecific_np(PL_thr_key);
-# else
- return (void*)pthread_getspecific(PL_thr_key);
-# endif
-# endif
+ return (void*)PTHREAD_GETSPECIFIC(PL_thr_key);
+# endif
# endif
#else
return (void*)NULL;