In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/6c4ca75d655dc560dfacf633c27f31f751e3f615?hp=d5910a3d38b3bf04d5da54f868438b2d8085a820>
- Log ----------------------------------------------------------------- commit 6c4ca75d655dc560dfacf633c27f31f751e3f615 Author: Dagfinn Ilmari Mannsåker <[email protected]> Date: Tue Jun 27 23:23:45 2017 +0100 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. M ext/arybase/arybase.pm M ext/arybase/arybase.xs M os2/os2.c M perlio.c M util.c commit 63d37b7a9c5afa5c76b6fc3d2bce6fd233be5802 Author: Dagfinn Ilmari Mannsåker <[email protected]> Date: Wed Jun 28 14:40:16 2017 +0100 Properly NOOP macros in thread.h M thread.h ----------------------------------------------------------------------- Summary of changes: ext/arybase/arybase.pm | 2 +- ext/arybase/arybase.xs | 14 -------------- os2/os2.c | 2 -- perlio.c | 18 ------------------ thread.h | 24 ++++++++++++------------ util.c | 8 -------- 6 files changed, 13 insertions(+), 55 deletions(-) diff --git a/ext/arybase/arybase.pm b/ext/arybase/arybase.pm index 64efe3e5d6..7168ccbf38 100644 --- a/ext/arybase/arybase.pm +++ b/ext/arybase/arybase.pm @@ -1,6 +1,6 @@ package arybase; -our $VERSION = "0.12"; +our $VERSION = "0.13"; require XSLoader; XSLoader::load(); # This returns true, which makes require happy. diff --git a/ext/arybase/arybase.xs b/ext/arybase/arybase.xs index 880bbe3a99..2521d4259e 100644 --- a/ext/arybase/arybase.xs +++ b/ext/arybase/arybase.xs @@ -26,9 +26,7 @@ STATIC perl_mutex ab_op_map_mutex; STATIC const ab_op_info *ab_map_fetch(const OP *o, ab_op_info *oi) { const ab_op_info *val; -#ifdef USE_ITHREADS MUTEX_LOCK(&ab_op_map_mutex); -#endif val = (ab_op_info *)ptable_fetch(ab_op_map, o); if (val) { @@ -36,9 +34,7 @@ STATIC const ab_op_info *ab_map_fetch(const OP *o, ab_op_info *oi) { val = oi; } -#ifdef USE_ITHREADS MUTEX_UNLOCK(&ab_op_map_mutex); -#endif return val; } @@ -65,28 +61,20 @@ STATIC void ab_map_store( { #define ab_map_store(O, PP, B) ab_map_store(aPTBLMS_ (O),(PP),(B)) -#ifdef USE_ITHREADS MUTEX_LOCK(&ab_op_map_mutex); -#endif ab_map_store_locked(o, old_pp, base); -#ifdef USE_ITHREADS MUTEX_UNLOCK(&ab_op_map_mutex); -#endif } STATIC void ab_map_delete(pTHX_ const OP *o) { #define ab_map_delete(O) ab_map_delete(aTHX_ (O)) -#ifdef USE_ITHREADS MUTEX_LOCK(&ab_op_map_mutex); -#endif ptable_map_store(ab_op_map, o, NULL); -#ifdef USE_ITHREADS MUTEX_UNLOCK(&ab_op_map_mutex); -#endif } /* ... $[ Implementation .............................................. */ @@ -412,9 +400,7 @@ BOOT: { if (!ab_initialized++) { ab_op_map = ptable_new(); -#ifdef USE_ITHREADS MUTEX_INIT(&ab_op_map_mutex); -#endif #define check(uc,lc,ck) \ wrap_op_checker(OP_##uc, ab_ck_##ck, &ab_old_ck_##lc) check(SASSIGN, sassign, sassign); diff --git a/os2/os2.c b/os2/os2.c index d7a4b58c35..8cb73671ad 100644 --- a/os2/os2.c +++ b/os2/os2.c @@ -4959,10 +4959,8 @@ Perl_OS2_init3(char **env, void **preg, int flags) if (PL_sh_path[i] == '\\') PL_sh_path[i] = '/'; } } -#if defined(USE_5005THREADS) || defined(USE_ITHREADS) MUTEX_INIT(&start_thread_mutex); MUTEX_INIT(&perlos2_state_mutex); -#endif os2_mytype = my_type(); /* Do it before morphing. Needed? */ os2_mytype_ini = os2_mytype; Perl_os2_initial_mode = -1; /* Uninit */ 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; } } diff --git a/thread.h b/thread.h index 9958a5bffb..869d294362 100644 --- a/thread.h +++ b/thread.h @@ -147,7 +147,7 @@ } STMT_END #define THREAD_CREATE(thr, f) (thr->self = cthread_fork(f, thr), 0) -#define THREAD_POST_CREATE(thr) +#define THREAD_POST_CREATE(thr) NOOP #define THREAD_RET_TYPE any_t #define THREAD_RET_CAST(x) ((any_t) x) @@ -378,47 +378,47 @@ #endif /* USE_ITHREADS */ #ifndef MUTEX_LOCK -# define MUTEX_LOCK(m) +# define MUTEX_LOCK(m) NOOP #endif #ifndef MUTEX_UNLOCK -# define MUTEX_UNLOCK(m) +# define MUTEX_UNLOCK(m) NOOP #endif #ifndef MUTEX_INIT -# define MUTEX_INIT(m) +# define MUTEX_INIT(m) NOOP #endif #ifndef MUTEX_DESTROY -# define MUTEX_DESTROY(m) +# define MUTEX_DESTROY(m) NOOP #endif #ifndef COND_INIT -# define COND_INIT(c) +# define COND_INIT(c) NOOP #endif #ifndef COND_SIGNAL -# define COND_SIGNAL(c) +# define COND_SIGNAL(c) NOOP #endif #ifndef COND_BROADCAST -# define COND_BROADCAST(c) +# define COND_BROADCAST(c) NOOP #endif #ifndef COND_WAIT -# define COND_WAIT(c, m) +# define COND_WAIT(c, m) NOOP #endif #ifndef COND_DESTROY -# define COND_DESTROY(c) +# define COND_DESTROY(c) NOOP #endif #ifndef LOCK_DOLLARZERO_MUTEX -# define LOCK_DOLLARZERO_MUTEX +# define LOCK_DOLLARZERO_MUTEX NOOP #endif #ifndef UNLOCK_DOLLARZERO_MUTEX -# define UNLOCK_DOLLARZERO_MUTEX +# define UNLOCK_DOLLARZERO_MUTEX NOOP #endif /* THR, SET_THR, and dTHR are there for compatibility with old versions */ diff --git a/util.c b/util.c index 584d2b8c2d..4584c735bc 100644 --- a/util.c +++ b/util.c @@ -5339,13 +5339,9 @@ 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 */ @@ -5402,13 +5398,9 @@ 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 */ -- Perl5 Master Repository
