summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-29 04:53:00 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-29 04:53:00 +0000
commitba869debd80c55cfae8e9d4de0991d62f9efcb9b (patch)
tree73f5810de88203f0df413aee0bc7f3c94d686329 /perl.h
parentd5c3ff09f505a33428a0772c6e16c91e1df4ce85 (diff)
downloadperl-ba869debd80c55cfae8e9d4de0991d62f9efcb9b.tar.gz
support fetching current interpreter from TLS under useithreads
p4raw-id: //depot/perl@5342
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/perl.h b/perl.h
index 7d42b0f2a3..0543a98169 100644
--- a/perl.h
+++ b/perl.h
@@ -1722,10 +1722,7 @@ typedef pthread_key_t perl_key;
# define PERL_WAIT_FOR_CHILDREN NOOP
#endif
-/* the traditional thread-unsafe notion of "current interpreter".
- * XXX todo: a thread-safe version that fetches it from TLS (akin to THR)
- * needs to be defined elsewhere (conditional on pthread_getspecific()
- * availability). */
+/* the traditional thread-unsafe notion of "current interpreter". */
#ifndef PERL_SET_INTERP
# define PERL_SET_INTERP(i) (PL_curinterp = (PerlInterpreter*)(i))
#endif
@@ -1734,20 +1731,35 @@ typedef pthread_key_t perl_key;
# define PERL_GET_INTERP (PL_curinterp)
#endif
+#ifndef PERL_SET_CONTEXT
+# define PERL_SET_CONTEXT(i) PERL_SET_INTERP(i)
+#endif
+
+#ifndef PERL_GET_CONTEXT
+# define PERL_GET_CONTEXT PERL_GET_INTERP
+#endif
+
#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_GET_THX)
# ifdef USE_THREADS
-# define PERL_GET_THX THR
+# define PERL_GET_THX ((struct perl_thread *)PERL_GET_CONTEXT)
# else
# ifdef MULTIPLICITY
-# define PERL_GET_THX PERL_GET_INTERP
+# define PERL_GET_THX ((PerlInterpreter *)PERL_GET_CONTEXT)
# else
# ifdef PERL_OBJECT
-# define PERL_GET_THX ((CPerlObj*)PERL_GET_INTERP)
-# else
-# define PERL_GET_THX ((void*)0)
+# define PERL_GET_THX ((CPerlObj *)PERL_GET_CONTEXT)
# endif
# endif
# endif
+# define PERL_SET_THX(t) PERL_SET_CONTEXT(t)
+#endif
+
+#ifndef PERL_GET_THX
+# define PERL_GET_THX ((void*)NULL)
+#endif
+
+#ifndef PERL_SET_THX
+# define PERL_SET_THX(t) NOOP
#endif
#ifndef SVf