summaryrefslogtreecommitdiff
path: root/thread.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-12-31 13:03:04 -0700
committerKarl Williamson <khw@cpan.org>2023-01-12 17:41:36 -0700
commit2dc676e9ce23feb0ae948ea62f7e4301931d2188 (patch)
tree49dffb8e372ebb860a43f9d81645d6ee2181efe3 /thread.h
parentdcf3fa421fa60f3cfa5535313b765af4dc49ba36 (diff)
downloadperl-2dc676e9ce23feb0ae948ea62f7e4301931d2188.tar.gz
Don't panic if can't destroy mutex during global destruction
It's going to be destroyed anyway; this just obscures what the real failure might be.
Diffstat (limited to 'thread.h')
-rw-r--r--thread.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/thread.h b/thread.h
index 5a2b3af619..474c2b43b6 100644
--- a/thread.h
+++ b/thread.h
@@ -221,13 +221,16 @@
RESTORE_ERRNO; \
} STMT_END
-# define MUTEX_DESTROY(m) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_mutex_destroy((m)))) { \
- Perl_croak_nocontext("panic: MUTEX_DESTROY (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
- } \
+# define MUTEX_DESTROY(m) \
+ STMT_START { \
+ int _eC_; \
+ if ((_eC_ = pthread_mutex_destroy((m)))) { \
+ dTHX; \
+ if (PL_phase != PERL_PHASE_DESTRUCT) { \
+ Perl_croak_nocontext("panic: MUTEX_DESTROY (%d) [%s:%d]", \
+ _eC_, __FILE__, __LINE__); \
+ } \
+ } \
} STMT_END
#endif /* MUTEX_INIT */
@@ -265,11 +268,15 @@
} STMT_END
# define COND_DESTROY(c) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_cond_destroy((c)))) \
- Perl_croak_nocontext("panic: COND_DESTROY (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+ STMT_START { \
+ int _eC_; \
+ if ((_eC_ = pthread_cond_destroy((c)))) { \
+ dTHX; \
+ if (PL_phase != PERL_PHASE_DESTRUCT) { \
+ Perl_croak_nocontext("panic: COND_DESTROY (%d) [%s:%d]", \
+ _eC_, __FILE__, __LINE__); \
+ } \
+ } \
} STMT_END
#endif /* COND_INIT */