summaryrefslogtreecommitdiff
path: root/thread.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-09-24 03:36:30 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-09-24 03:36:30 +0000
commit5f08fbcd6341ee0f8f3c7dfe721098c3bfae1c67 (patch)
treea70127e53b67320af4d734e666f8494d502244f6 /thread.h
parent34b5802582e6ac0ab95ef6940fa408896842b141 (diff)
downloadperl-5f08fbcd6341ee0f8f3c7dfe721098c3bfae1c67.tar.gz
provide locked access to string table for USE_THREADS
p4raw-id: //depot/perl@1863
Diffstat (limited to 'thread.h')
-rw-r--r--thread.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/thread.h b/thread.h
index 3eb061a22a..035c5caec9 100644
--- a/thread.h
+++ b/thread.h
@@ -161,16 +161,29 @@ struct perl_thread *getTHR _((void));
* Systems with very fast mutexes (and/or slow conditionals) may wish to
* remove the "if (threadnum) ..." test.
*/
-#define LOCK_SV_MUTEX \
- STMT_START { \
+#define LOCK_SV_MUTEX \
+ STMT_START { \
+ if (PL_threadnum) \
+ MUTEX_LOCK(&PL_sv_mutex); \
+ } STMT_END
+
+#define UNLOCK_SV_MUTEX \
+ STMT_START { \
if (PL_threadnum) \
- MUTEX_LOCK(&PL_sv_mutex); \
+ MUTEX_UNLOCK(&PL_sv_mutex); \
} STMT_END
-#define UNLOCK_SV_MUTEX \
- STMT_START { \
+/* Likewise for strtab_mutex */
+#define LOCK_STRTAB_MUTEX \
+ STMT_START { \
+ if (PL_threadnum) \
+ MUTEX_LOCK(&PL_strtab_mutex); \
+ } STMT_END
+
+#define UNLOCK_STRTAB_MUTEX \
+ STMT_START { \
if (PL_threadnum) \
- MUTEX_UNLOCK(&PL_sv_mutex); \
+ MUTEX_UNLOCK(&PL_strtab_mutex); \
} STMT_END
#ifndef THREAD_RET_TYPE
@@ -223,6 +236,8 @@ typedef struct condpair {
#define COND_DESTROY(c)
#define LOCK_SV_MUTEX
#define UNLOCK_SV_MUTEX
+#define LOCK_STRTAB_MUTEX
+#define UNLOCK_STRTAB_MUTEX
#define THR
/* Rats: if dTHR is just blank then the subsequent ";" throws an error */