From: Tilghman Lesher Date: Thu, 5 Aug 2010 07:28:33 +0000 (+0000) Subject: Change context lock back to a mutex, because functionality depends upon the lock... X-Git-Tag: 1.4.36-rc1~3^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7cb184823fcac345736f28862ec6cad883a13f9;p=thirdparty%2Fasterisk.git Change context lock back to a mutex, because functionality depends upon the lock being recursive. (closes issue #17643) Reported by: zerohalo Patches: 20100726__issue17643.diff.txt uploaded by tilghman (license 14) Tested by: zerohalo git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@280982 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/pbx.c b/main/pbx.c index 1ad2d2e1d7..e88bdb879f 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -492,7 +492,11 @@ static struct pbx_builtin { }; static struct ast_context *contexts; -AST_RWLOCK_DEFINE_STATIC(conlock); /*!< Lock for the ast_context list */ +/*!\brief Lock for the ast_context list + * This lock MUST be recursive, or a deadlock on reload may result. See + * https://issues.asterisk.org/view.php?id=17643 + */ +AST_MUTEX_DEFINE_STATIC(conlock); static AST_LIST_HEAD_STATIC(apps, ast_app); @@ -6193,22 +6197,22 @@ int load_pbx(void) */ int ast_lock_contexts() { - return ast_rwlock_wrlock(&conlock); + return ast_mutex_lock(&conlock); } int ast_rdlock_contexts(void) { - return ast_rwlock_rdlock(&conlock); + return ast_mutex_lock(&conlock); } int ast_wrlock_contexts(void) { - return ast_rwlock_wrlock(&conlock); + return ast_mutex_lock(&conlock); } int ast_unlock_contexts() { - return ast_rwlock_unlock(&conlock); + return ast_mutex_unlock(&conlock); } /*