summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorMax Maischein <corion@corion.net>2009-12-17 23:22:39 +0100
committerJan Dubois <jand@activestate.com>2009-12-17 15:32:44 -0800
commit8703a9a4fd75723318bc4ba1afc42a215806f2d1 (patch)
treed85a5c22446075dab50cf156f9a8b2c3c75ca117 /util.c
parent229c5935ba2b931e7f367cc5b2706adeee57ee47 (diff)
downloadperl-8703a9a4fd75723318bc4ba1afc42a215806f2d1.tar.gz
Correct some #ifdef USE_ITHREADS / USE_MULTI
Diffstat (limited to 'util.c')
-rw-r--r--util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util.c b/util.c
index 0aab7868db..70f5a260db 100644
--- a/util.c
+++ b/util.c
@@ -5837,9 +5837,13 @@ Perl_my_cxt_init(pTHX_ int *index, size_t size)
PERL_ARGS_ASSERT_MY_CXT_INIT;
if (*index == -1) {
/* this module hasn't been allocated an index yet */
+#if defined(USE_ITHREADS)
MUTEX_LOCK(&PL_my_ctx_mutex);
+#endif
*index = PL_my_cxt_index++;
+#if defined(USE_ITHREADS)
MUTEX_UNLOCK(&PL_my_ctx_mutex);
+#endif
}
/* make sure the array is big enough */
@@ -5894,9 +5898,13 @@ Perl_my_cxt_init(pTHX_ const char *my_cxt_key, size_t size)
index = Perl_my_cxt_index(aTHX_ my_cxt_key);
if (index == -1) {
/* this module hasn't been allocated an index yet */
+#if defined(USE_ITHREADS)
MUTEX_LOCK(&PL_my_ctx_mutex);
+#endif
index = PL_my_cxt_index++;
+#if defined(USE_ITHREADS)
MUTEX_UNLOCK(&PL_my_ctx_mutex);
+#endif
}
/* make sure the array is big enough */