Skip to content

Commit

Permalink
Don't panic if can't destroy mutex during global destruction
Browse files Browse the repository at this point in the history
It's going to be destroyed anyway; this just obscures what the real
failure might be.
  • Loading branch information
khwilliamson committed Jan 13, 2023
1 parent dcf3fa4 commit 2dc676e
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 2dc676e

Please sign in to comment.