summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-06-07 01:56:29 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-06-07 01:56:29 +0000
commitb8b4c9f3cf6ef09c878a80ff97526a69902a44ca (patch)
treeea3db5e3a3619c3206d2b1250e7aae2ab1771a46
parent6c85703cf9eae156b03f18186f39b571bd208c32 (diff)
downloadperl-b8b4c9f3cf6ef09c878a80ff97526a69902a44ca.tar.gz
Mopup for #6207 and #6209.
p4raw-id: //depot/cfgperl@6210
-rw-r--r--doio.c4
-rw-r--r--gv.c5
-rw-r--r--sv.h8
-rw-r--r--util.c12
-rw-r--r--vmesa/vmesa.c16
-rw-r--r--win32/win32.c8
6 files changed, 28 insertions, 25 deletions
diff --git a/doio.c b/doio.c
index c3d6f50715..6d03b20306 100644
--- a/doio.c
+++ b/doio.c
@@ -476,13 +476,13 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
SV *sv;
PerlLIO_dup2(PerlIO_fileno(fp), fd);
- FDPID_LOCK();
+ FDPID_LOCK;
sv = *av_fetch(PL_fdpid,PerlIO_fileno(fp),TRUE);
(void)SvUPGRADE(sv, SVt_IV);
pid = SvIVX(sv);
SvIVX(sv) = 0;
sv = *av_fetch(PL_fdpid,fd,TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
(void)SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pid;
if (!was_fdopen)
diff --git a/gv.c b/gv.c
index 39dbd1b34c..1c3a95354e 100644
--- a/gv.c
+++ b/gv.c
@@ -436,12 +436,17 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
varstash = GvSTASH(CvGV(cv));
vargv = *(GV**)hv_fetch(varstash, autoload, autolen, TRUE);
ENTER;
+
+#ifdef USE_THREADS
Perl_lock(aTHX_ (SV *)varstash);
+#endif
if (!isGV(vargv))
gv_init(vargv, varstash, autoload, autolen, FALSE);
LEAVE;
varsv = GvSV(vargv);
+#ifdef USE_THREADS
Perl_lock(aTHX_ varsv);
+#endif
sv_setpv(varsv, HvNAME(stash));
sv_catpvn(varsv, "::", 2);
sv_catpvn(varsv, name, len);
diff --git a/sv.h b/sv.h
index 10ea0afd61..f35049862a 100644
--- a/sv.h
+++ b/sv.h
@@ -1067,9 +1067,9 @@ Release the internal mutex for an SV.
#define Sv_Grow sv_grow
#ifdef USE_THREADS
-# define FDPID_LOCK() MUTEX_LOCK(&PL_fdpid_mutex)
-# define FDPID_UNLOCK() MUTEX_UNLOCK(&PL_fdpid_mutex)
+# define FDPID_LOCK MUTEX_LOCK(&PL_fdpid_mutex)
+# define FDPID_UNLOCK MUTEX_UNLOCK(&PL_fdpid_mutex)
#else
-# define FDPID_LOCK()
-# define FDPID_UNLOCK()
+# define FDPID_LOCK
+# define FDPID_UNLOCK
#endif
diff --git a/util.c b/util.c
index 4f55376209..38591e9ea5 100644
--- a/util.c
+++ b/util.c
@@ -2402,9 +2402,9 @@ Perl_my_popen(pTHX_ char *cmd, char *mode)
PerlLIO_close(p[This]);
p[This] = p[that];
}
- FDPID_LOCK();
+ FDPID_LOCK;
sv = *av_fetch(PL_fdpid,p[This],TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
(void)SvUPGRADE(sv,SVt_IV);
SvIVX(sv) = pid;
PL_forkprocess = pid;
@@ -2622,9 +2622,9 @@ Perl_my_pclose(pTHX_ PerlIO *ptr)
int saved_win32_errno;
#endif
- FDPID_LOCK();
+ FDPID_LOCK;
svp = av_fetch(PL_fdpid,PerlIO_fileno(ptr),TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
pid = SvIVX(*svp);
SvREFCNT_dec(*svp);
*svp = &PL_sv_undef;
@@ -3499,7 +3499,6 @@ Perl_condpair_magic(pTHX_ SV *sv)
SV *
Perl_lock(pTHX_ SV *osv)
{
-#ifdef USE_THREADS
MAGIC *mg;
SV *sv = osv;
@@ -3518,12 +3517,11 @@ Perl_lock(pTHX_ SV *osv)
while (MgOWNER(mg))
COND_WAIT(MgOWNERCONDP(mg), MgMUTEXP(mg));
MgOWNER(mg) = thr;
- DEBUG_S(PerlIO_printf(Perl_debug_log, "0x%"UVxf": pp_lock lock 0x%"UVxf"\n",
+ DEBUG_S(PerlIO_printf(Perl_debug_log, "0x%"UVxf": Perl_lock lock 0x%"UVxf"\n",
PTR2UV(thr), PTR2UV(sv));)
MUTEX_UNLOCK(MgMUTEXP(mg));
SAVEDESTRUCTOR_X(Perl_unlock_condpair, sv);
}
-#endif
SvUNLOCK(sv);
return sv;
}
diff --git a/vmesa/vmesa.c b/vmesa/vmesa.c
index 77f2149597..b39638086f 100644
--- a/vmesa/vmesa.c
+++ b/vmesa/vmesa.c
@@ -182,13 +182,13 @@ do_aspawn(SV* really, SV **mark, SV **sp)
/* be used by my_pclose */
/*---------------------------------------------*/
close(fd);
- FDPID_LOCK();
+ FDPID_LOCK;
p_sv = av_fetch(PL_fdpid,fd,TRUE);
fd = (int) SvIVX(*p_sv);
SvREFCNT_dec(*p_sv);
*p_sv = &PL_sv_undef;
sv = *av_fetch(PL_fdpid,fd,TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
(void) SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pid;
status = 0;
@@ -414,9 +414,9 @@ my_popen(char *cmd, char *mode)
pid = spawn_cmd(cmd, Perl_stdin_fd, Perl_stdout_fd);
if (pid >= 0)
{
- FDPID_LOCK();
+ FDPID_LOCK;
sv = *av_fetch(PL_fdpid,pFd[this],TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
(void) SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pid;
fd = PerlIO_fdopen(pFd[this], mode);
@@ -427,9 +427,9 @@ my_popen(char *cmd, char *mode)
}
else
{
- FDPID_LOCK();
+ FDPID_LOCK;
sv = *av_fetch(PL_fdpid,pFd[that],TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
(void) SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pFd[this];
fd = PerlIO_fdopen(pFd[this], mode);
@@ -466,9 +466,9 @@ my_pclose(FILE *fp)
SV **sv;
FILE *other;
- FDPID_LOCK();
+ FDPID_LOCK;
sv = av_fetch(PL_fdpid,PerlIO_fileno(fp),TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
pid = (int) SvIVX(*sv);
SvREFCNT_dec(*sv);
*sv = &PL_sv_undef;
diff --git a/win32/win32.c b/win32/win32.c
index 01dd5d22e7..7cc8a271b8 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2390,9 +2390,9 @@ win32_popen(const char *command, const char *mode)
/* close saved handle */
win32_close(oldfd);
- FDPID_LOCK();
+ FDPID_LOCK;
sv_setiv(*av_fetch(w32_fdpid, p[parent], TRUE), childpid);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
/* set process id so that it can be returned by perl's open() */
PL_forkprocess = childpid;
@@ -2428,9 +2428,9 @@ win32_pclose(FILE *pf)
int childpid, status;
SV *sv;
- FDPID_LOCK();
+ FDPID_LOCK;
sv = *av_fetch(w32_fdpid, win32_fileno(pf), TRUE);
- FDPID_UNLOCK();
+ FDPID_UNLOCK;
if (SvIOK(sv))
childpid = SvIVX(sv);
else