summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-05-03 18:38:50 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-05-10 10:35:22 +0000
commit90866323e988eded2d449f93e3ad86d3d1542814 (patch)
tree34dd5b9c68e9ca7e732bfcd149f210faabc1c48e /os2
parent27533608423d4f8b8ffa4951b5d211f972816882 (diff)
downloadperl-90866323e988eded2d449f93e3ad86d3d1542814.tar.gz
Quickier thread-specific data on OS/2
Message-Id: <199905040238.WAA01865@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@3369
Diffstat (limited to 'os2')
-rw-r--r--os2/os2ish.h13
-rw-r--r--os2/os2thread.h4
2 files changed, 14 insertions, 3 deletions
diff --git a/os2/os2ish.h b/os2/os2ish.h
index 97b489b40d..cfd13c8335 100644
--- a/os2/os2ish.h
+++ b/os2/os2ish.h
@@ -148,10 +148,17 @@ extern int rc;
#define dTHR struct thread *thr = THR
*/
-#define pthread_getspecific(k) (*_threadstore())
-#define pthread_setspecific(k,v) (*_threadstore()=v,0)
+#ifdef USE_SLOW_THREAD_SPECIFIC
+# define pthread_getspecific(k) (*_threadstore())
+# define pthread_setspecific(k,v) (*_threadstore()=v,0)
+# define pthread_key_create(keyp,flag) (*keyp=_gettid(),0)
+#else
+# define pthread_getspecific(k) (*(k))
+# define pthread_setspecific(k,v) (*(k)=(v),0)
+# define pthread_key_create(keyp,flag) (DosAllocThreadLocalMemory(1,(U32*)keyp) ? croak("LocalMemory"),1 : 0)
+#endif
+#define pthread_key_delete(keyp)
#define pthread_self() _gettid()
-#define pthread_key_create(keyp,flag) (*keyp=_gettid(),0)
#define YIELD DosSleep(0)
#ifdef PTHREADS_INCLUDED /* For ./x2p stuff. */
diff --git a/os2/os2thread.h b/os2/os2thread.h
index d56fe160dd..9516ddda0b 100644
--- a/os2/os2thread.h
+++ b/os2/os2thread.h
@@ -8,7 +8,11 @@ typedef _rmutex perl_mutex;
/*typedef HEV perl_cond;*/ /* Will include os2.h into all C files. */
typedef unsigned long perl_cond;
+#ifdef USE_SLOW_THREAD_SPECIFIC
typedef int perl_key;
+#else
+typedef void** perl_key;
+#endif
typedef unsigned long pthread_attr_t;
#define PTHREADS_INCLUDED