From 4e04f5f731382ca4b50b864d16b164d30f78e5a8 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Tue, 29 Nov 2005 01:25:28 +0000 Subject: [PATCH] if the lock protected a pthread_cond is held recursively, warn before waiting onthe condition git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@7213 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/lock.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index cea5d06a17..39af897361 100755 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -396,6 +396,10 @@ static inline int __ast_cond_wait(const char *filename, int lineno, const char * #endif } + if (t->reentrancy) + __ast_mutex_logger("%s line %d (%s): mutex '%s' locked more than once, cond_wait will block!\n", + filename, lineno, func, mutex_name); + if (--t->reentrancy < 0) { __ast_mutex_logger("%s line %d (%s): mutex '%s' freed more times than we've locked!\n", filename, lineno, func, mutex_name); @@ -455,6 +459,10 @@ static inline int __ast_cond_timedwait(const char *filename, int lineno, const c #endif } + if (t->reentrancy) + __ast_mutex_logger("%s line %d (%s): mutex '%s' locked more than once, cond_timedwait will block!\n", + filename, lineno, func, mutex_name); + if (--t->reentrancy < 0) { __ast_mutex_logger("%s line %d (%s): mutex '%s' freed more times than we've locked!\n", filename, lineno, func, mutex_name);