[asterisk-commits] murf: branch murf/bug7836 r48682 - in
/team/murf/bug7836: ./ main/pbx.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Dec 20 18:57:26 MST 2006
Author: murf
Date: Wed Dec 20 19:57:26 2006
New Revision: 48682
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48682
Log:
Merged revisions 48680 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r48680 | file | 2006-12-20 18:48:35 -0700 (Wed, 20 Dec 2006) | 2 lines
Convert alternate dialplan switch list to use read/write locks.
........
Modified:
team/murf/bug7836/ (props changed)
team/murf/bug7836/main/pbx.c
Propchange: team/murf/bug7836/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Dec 20 19:57:26 2006
@@ -1,1 +1,1 @@
-/trunk:1-48665
+/trunk:1-48681
Modified: team/murf/bug7836/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug7836/main/pbx.c?view=diff&rev=48682&r1=48681&r2=48682
==============================================================================
--- team/murf/bug7836/main/pbx.c (original)
+++ team/murf/bug7836/main/pbx.c Wed Dec 20 19:57:26 2006
@@ -465,7 +465,7 @@
static AST_RWLIST_HEAD_STATIC(apps, ast_app);
-static AST_LIST_HEAD_STATIC(switches, ast_switch);
+static AST_RWLIST_HEAD_STATIC(switches, ast_switch);
static int stateid = 1;
/* WARNING:
@@ -536,12 +536,12 @@
{
struct ast_switch *asw;
- AST_LIST_LOCK(&switches);
- AST_LIST_TRAVERSE(&switches, asw, list) {
+ AST_RWLIST_RDLOCK(&switches);
+ AST_RWLIST_TRAVERSE(&switches, asw, list) {
if (!strcasecmp(asw->name, sw))
break;
}
- AST_LIST_UNLOCK(&switches);
+ AST_RWLIST_UNLOCK(&switches);
return asw;
}
@@ -2865,25 +2865,25 @@
{
struct ast_switch *tmp;
- AST_LIST_LOCK(&switches);
- AST_LIST_TRAVERSE(&switches, tmp, list) {
+ AST_RWLIST_WRLOCK(&switches);
+ AST_RWLIST_TRAVERSE(&switches, tmp, list) {
if (!strcasecmp(tmp->name, sw->name)) {
- AST_LIST_UNLOCK(&switches);
+ AST_RWLIST_UNLOCK(&switches);
ast_log(LOG_WARNING, "Switch '%s' already found\n", sw->name);
return -1;
}
}
- AST_LIST_INSERT_TAIL(&switches, sw, list);
- AST_LIST_UNLOCK(&switches);
+ AST_RWLIST_INSERT_TAIL(&switches, sw, list);
+ AST_RWLIST_UNLOCK(&switches);
return 0;
}
void ast_unregister_switch(struct ast_switch *sw)
{
- AST_LIST_LOCK(&switches);
- AST_LIST_REMOVE(&switches, sw, list);
- AST_LIST_UNLOCK(&switches);
+ AST_RWLIST_WRLOCK(&switches);
+ AST_RWLIST_REMOVE(&switches, sw, list);
+ AST_RWLIST_UNLOCK(&switches);
}
/*
@@ -3065,19 +3065,19 @@
{
struct ast_switch *sw;
- AST_LIST_LOCK(&switches);
-
- if (AST_LIST_EMPTY(&switches)) {
- AST_LIST_UNLOCK(&switches);
+ AST_RWLIST_RDLOCK(&switches);
+
+ if (AST_RWLIST_EMPTY(&switches)) {
+ AST_RWLIST_UNLOCK(&switches);
ast_cli(fd, "There are no registered alternative switches\n");
return RESULT_SUCCESS;
}
ast_cli(fd, "\n -= Registered Asterisk Alternative Switches =-\n");
- AST_LIST_TRAVERSE(&switches, sw, list)
+ AST_RWLIST_TRAVERSE(&switches, sw, list)
ast_cli(fd, "%s: %s\n", sw->name, sw->description);
- AST_LIST_UNLOCK(&switches);
+ AST_RWLIST_UNLOCK(&switches);
return RESULT_SUCCESS;
}
More information about the asterisk-commits
mailing list