diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-09-24 03:36:30 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-09-24 03:36:30 +0000 |
commit | 5f08fbcd6341ee0f8f3c7dfe721098c3bfae1c67 (patch) | |
tree | a70127e53b67320af4d734e666f8494d502244f6 /thread.h | |
parent | 34b5802582e6ac0ab95ef6940fa408896842b141 (diff) | |
download | perl-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.h | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -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 */ |