summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-12 05:10:50 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-12 05:10:50 +0000
commit5c0ca7990f0d90291b9a3d0b6c57bae560b23b52 (patch)
tree26fb0eee534215ebaa9caa2327d1ee6ac37d3bb7 /ext
parent8b49bb9af6b73f5b844abedd87486b1c41fc6b01 (diff)
downloadperl-5c0ca7990f0d90291b9a3d0b6c57bae560b23b52.tar.gz
make RE engine threadsafe; -Dusethreads builds, tests on Solaris,
and runs regexes in 1000s of threads without crashing; also fixed statcache not being thread-local p4raw-id: //depot/perl@1448
Diffstat (limited to 'ext')
-rw-r--r--ext/Thread/Thread.xs7
-rw-r--r--ext/re/re.xs2
2 files changed, 9 insertions, 0 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs
index 28583a19bd..be1e7af560 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -149,6 +149,7 @@ threadstart(void *arg)
SvREFCNT_dec(thr->specific);
SvREFCNT_dec(thr->errsv);
SvREFCNT_dec(thr->errhv);
+
Safefree(markstack);
Safefree(scopestack);
Safefree(savestack);
@@ -157,6 +158,12 @@ threadstart(void *arg)
Safefree(tmps_stack);
Safefree(ofs);
+ SvREFCNT_dec(statname);
+ Safefree(screamfirst);
+ Safefree(screamnext);
+ Safefree(reg_start_tmp);
+ SvREFCNT_dec(lastscream);
+
MUTEX_LOCK(&thr->mutex);
DEBUG_L(PerlIO_printf(PerlIO_stderr(),
"%p: threadstart finishing: state is %u\n",
diff --git a/ext/re/re.xs b/ext/re/re.xs
index 7b9fb379cd..2d0f18700a 100644
--- a/ext/re/re.xs
+++ b/ext/re/re.xs
@@ -14,6 +14,7 @@ static int oldfl;
static void
deinstall(void)
{
+ dTHR;
regexecp = &regexec_flags;
regcompp = &pregcomp;
if (!oldfl)
@@ -23,6 +24,7 @@ deinstall(void)
static void
install(void)
{
+ dTHR;
regexecp = &my_regexec;
regcompp = &my_regcomp;
oldfl = debug & R_DB;