diff options
author | Karl Williamson <khw@cpan.org> | 2022-12-31 13:03:04 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2023-01-12 17:41:36 -0700 |
commit | 2dc676e9ce23feb0ae948ea62f7e4301931d2188 (patch) | |
tree | 49dffb8e372ebb860a43f9d81645d6ee2181efe3 /thread.h | |
parent | dcf3fa421fa60f3cfa5535313b765af4dc49ba36 (diff) | |
download | perl-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.h | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -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 */ |