summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-10-30 00:45:47 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-10-30 00:45:47 +0000
commitfa06ce2e6c8729878121cce951dbf9c0128336d8 (patch)
tree32bb9e25f0b79adee4f41cef39cce3eb68fb7828 /main/pbx.c
parent5652a7b81ede72b23199f5cd166d37c050dc86b5 (diff)
Track down and fix annoying lock errors
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/main/pbx.c b/main/pbx.c
index a55b6884f..b86cb38ce 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3228,15 +3228,18 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
}
/*! \brief Find hint for given extension in context */
-static struct ast_exten *ast_hint_extension(struct ast_channel *c, const char *context, const char *exten)
+static struct ast_exten *ast_hint_extension_nolock(struct ast_channel *c, const char *context, const char *exten)
{
- struct ast_exten *e;
struct pbx_find_info q = { .stacklen = 0 }; /* the rest is set in pbx_find_context */
+ return pbx_find_extension(c, NULL, &q, context, exten, PRIORITY_HINT, NULL, "", E_MATCH);
+}
+static struct ast_exten *ast_hint_extension(struct ast_channel *c, const char *context, const char *exten)
+{
+ struct ast_exten *e;
ast_rdlock_contexts();
- e = pbx_find_extension(c, NULL, &q, context, exten, PRIORITY_HINT, NULL, "", E_MATCH);
+ e = ast_hint_extension_nolock(c, context, exten);
ast_unlock_contexts();
-
return e;
}
@@ -6032,7 +6035,8 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_
if (exten && exten->exten[0] == '_') {
ast_add_extension(exten->parent->name, 0, this->exten, PRIORITY_HINT, NULL,
0, exten->app, ast_strdup(exten->data), ast_free_ptr, registrar);
- exten = ast_hint_extension(NULL, this->context, this->exten);
+ /* rwlocks are not recursive locks */
+ exten = ast_hint_extension_nolock(NULL, this->context, this->exten);
}
/* Find the hint in the list of hints */