This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Unwind save stack in sync with POPEVAL
[perl5.git] / thread.h
index cd55635..9958a5b 100644 (file)
--- a/thread.h
+++ b/thread.h
     } STMT_END
 #  endif
 
+#  ifdef PERL_TSA_ACTIVE
+#    define perl_pthread_mutex_lock(m) perl_tsa_mutex_lock(m)
+#    define perl_pthread_mutex_unlock(m) perl_tsa_mutex_unlock(m)
+#  else
+#    define perl_pthread_mutex_lock(m) pthread_mutex_lock(m)
+#    define perl_pthread_mutex_unlock(m) pthread_mutex_unlock(m)
+#  endif
+
 #  define MUTEX_LOCK(m) \
     STMT_START {                                               \
        int _eC_;                                               \
-       if ((_eC_ = pthread_mutex_lock((m))))                   \
+       if ((_eC_ = perl_pthread_mutex_lock((m))))                      \
            Perl_croak_nocontext("panic: MUTEX_LOCK (%d) [%s:%d]",      \
                                 _eC_, __FILE__, __LINE__);     \
     } STMT_END
 #  define MUTEX_UNLOCK(m) \
     STMT_START {                                               \
        int _eC_;                                               \
-       if ((_eC_ = pthread_mutex_unlock((m))))                 \
+       if ((_eC_ = perl_pthread_mutex_unlock((m))))                    \
            Perl_croak_nocontext("panic: MUTEX_UNLOCK (%d) [%s:%d]",    \
                                 _eC_, __FILE__, __LINE__);     \
     } STMT_END
 #  define ALLOC_THREAD_KEY \
     STMT_START {                                               \
        if (pthread_key_create(&PL_thr_key, 0)) {               \
-            int rc;                                             \
-            rc = write(2, STR_WITH_LEN("panic: pthread_key_create failed\n")); \
-            PERL_UNUSED_VAR(rc);                                \
+            PERL_UNUSED_RESULT(write(2, STR_WITH_LEN("panic: pthread_key_create failed\n"))); \
            exit(1);                                            \
        }                                                       \
     } STMT_END
 #endif
 
 /*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
  * ex: set ts=8 sts=4 sw=4 et:
  */