summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2017-06-27 23:23:45 +0100
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2017-07-03 16:32:41 +0100
commit6c4ca75d655dc560dfacf633c27f31f751e3f615 (patch)
tree8041e15aa63e4b225d6e731d803f33e151fbeaa4 /perlio.c
parent63d37b7a9c5afa5c76b6fc3d2bce6fd233be5802 (diff)
downloadperl-6c4ca75d655dc560dfacf633c27f31f751e3f615.tar.gz
Remove #ifdef USE_ITHREADS around MUTEX_* calls
These macros are defined as NOOP outside USE_ITHREADS, so there's no point in guarding them with it.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/perlio.c b/perlio.c
index e9d3700cfe..209af1b0f1 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2274,9 +2274,7 @@ S_more_refcounted_fds(pTHX_ const int new_fd)
new_array = (int*) realloc(PL_perlio_fd_refcnt, new_max * sizeof(int));
if (!new_array) {
-#ifdef USE_ITHREADS
MUTEX_UNLOCK(&PL_perlio_mutex);
-#endif
croak_no_mem();
}
@@ -2305,9 +2303,7 @@ PerlIOUnix_refcnt_inc(int fd)
if (fd >= 0) {
dVAR;
-#ifdef USE_ITHREADS
MUTEX_LOCK(&PL_perlio_mutex);
-#endif
if (fd >= PL_perlio_fd_refcnt_size)
S_more_refcounted_fds(aTHX_ fd);
@@ -2320,9 +2316,7 @@ PerlIOUnix_refcnt_inc(int fd)
DEBUG_i( PerlIO_debug("refcnt_inc: fd %d refcnt=%d\n",
fd, PL_perlio_fd_refcnt[fd]) );
-#ifdef USE_ITHREADS
MUTEX_UNLOCK(&PL_perlio_mutex);
-#endif
} else {
/* diag_listed_as: refcnt_inc: fd %d%s */
Perl_croak(aTHX_ "refcnt_inc: fd %d < 0\n", fd);
@@ -2339,9 +2333,7 @@ PerlIOUnix_refcnt_dec(int fd)
#else
dVAR;
#endif
-#ifdef USE_ITHREADS
MUTEX_LOCK(&PL_perlio_mutex);
-#endif
if (fd >= PL_perlio_fd_refcnt_size) {
/* diag_listed_as: refcnt_dec: fd %d%s */
Perl_croak_nocontext("refcnt_dec: fd %d >= refcnt_size %d\n",
@@ -2354,9 +2346,7 @@ PerlIOUnix_refcnt_dec(int fd)
}
cnt = --PL_perlio_fd_refcnt[fd];
DEBUG_i( PerlIO_debug("refcnt_dec: fd %d refcnt=%d\n", fd, cnt) );
-#ifdef USE_ITHREADS
MUTEX_UNLOCK(&PL_perlio_mutex);
-#endif
} else {
/* diag_listed_as: refcnt_dec: fd %d%s */
Perl_croak_nocontext("refcnt_dec: fd %d < 0\n", fd);
@@ -2371,9 +2361,7 @@ PerlIOUnix_refcnt(int fd)
int cnt = 0;
if (fd >= 0) {
dVAR;
-#ifdef USE_ITHREADS
MUTEX_LOCK(&PL_perlio_mutex);
-#endif
if (fd >= PL_perlio_fd_refcnt_size) {
/* diag_listed_as: refcnt: fd %d%s */
Perl_croak(aTHX_ "refcnt: fd %d >= refcnt_size %d\n",
@@ -2385,9 +2373,7 @@ PerlIOUnix_refcnt(int fd)
fd, PL_perlio_fd_refcnt[fd]);
}
cnt = PL_perlio_fd_refcnt[fd];
-#ifdef USE_ITHREADS
MUTEX_UNLOCK(&PL_perlio_mutex);
-#endif
} else {
/* diag_listed_as: refcnt: fd %d%s */
Perl_croak(aTHX_ "refcnt: fd %d < 0\n", fd);
@@ -3290,7 +3276,6 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
if (stdio == stdout || stdio == stderr)
return PerlIO_flush(f);
}
-#ifdef USE_ITHREADS
MUTEX_LOCK(&PL_perlio_mutex);
/* Right. We need a mutex here because for a brief while we
will have the situation that fd is actually closed. Hence if
@@ -3309,7 +3294,6 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
Except that correctness trumps speed.
Advice from klortho #11912. */
-#endif
if (invalidate) {
/* Tricky - must fclose(stdio) to free memory but not close(fd)
Use Sarathy's trick from maint-5.6 to invalidate the
@@ -3347,9 +3331,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
PerlLIO_dup2(dupfd,fd);
PerlLIO_close(dupfd);
}
-#ifdef USE_ITHREADS
MUTEX_UNLOCK(&PL_perlio_mutex);
-#endif
return result;
}
}