aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_while.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-28 20:46:01 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-28 20:46:01 +0000
commit1b36eef6f45c9e4719848747494e1b839f5a1508 (patch)
tree93f9b6140eb5d6e502d59f61dc94af1c440c16b8 /apps/app_while.c
parentb90c312913754e4e0f9dad38a9cc7b7ac21160d5 (diff)
Convert the PBX core to use read/write locks. This yields a nifty performance improvement when it comes to simultaneous calls going through the dialplan. Using murf's test the old mutex based core took an average of 57.3 seconds while the rwlock based core took 31.1 seconds. That's a nifty 26.2 seconds performance improvement. The other good part is that if we do need to switch back then we just have to change the lock/unlock API calls. I converted everywhere that used to touch the mutex locks directly to use them.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@57184 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_while.c')
-rw-r--r--apps/app_while.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/app_while.c b/apps/app_while.c
index 8595916f3..ddc581ed9 100644
--- a/apps/app_while.c
+++ b/apps/app_while.c
@@ -125,7 +125,7 @@ static int find_matching_endwhile(struct ast_channel *chan)
struct ast_context *c;
int res=-1;
- if (ast_lock_contexts()) {
+ if (ast_rdlock_contexts()) {
ast_log(LOG_ERROR, "Failed to lock contexts list\n");
return -1;
}
@@ -133,7 +133,7 @@ static int find_matching_endwhile(struct ast_channel *chan)
for (c=ast_walk_contexts(NULL); c; c=ast_walk_contexts(c)) {
struct ast_exten *e;
- if (!ast_lock_context(c)) {
+ if (!ast_rdlock_context(c)) {
if (!strcmp(ast_get_context_name(c), chan->context)) {
/* This is the matching context we want */
int cur_priority = chan->priority + 1, level=1;