dect
/
asterisk
Archived
13
0
Fork 0

fix various bugs related to list handling of channel variables (issue #5548)

use nolock lists for channel variables, since no locks are needed (these lists are either temporary or protected by the channel's own lock)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6900 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
kpfleming 2005-10-31 15:34:11 +00:00
parent 8615ded129
commit 3b5ed22f12
7 changed files with 9 additions and 6 deletions

View File

@ -585,7 +585,7 @@ struct ast_channel *ast_channel_alloc(int needqueue)
snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long) time(NULL), uniqueint++);
headp = &tmp->varshead;
ast_mutex_init(&tmp->lock);
AST_LIST_HEAD_INIT(headp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
strcpy(tmp->context, "default");
ast_copy_string(tmp->language, defaultlanguage, sizeof(tmp->language));
strcpy(tmp->exten, "s");
@ -2976,7 +2976,7 @@ int ast_do_masquerade(struct ast_channel *original)
original->fds[x] = clone->fds[x];
}
clone_variables(original, clone);
clone->varshead.first = NULL;
AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
/* Presense of ADSI capable CPE follows clone */
original->adsicpe = clone->adsicpe;
/* Bridge remains the same */

View File

@ -47,7 +47,6 @@
#include "asterisk/channel.h"
struct ast_channel;
AST_LIST_HEAD(varshead,ast_var_t);
/*! Responsible for call detail data */
struct ast_cdr {

View File

@ -31,6 +31,8 @@ struct ast_var_t {
char name[0];
};
AST_LIST_HEAD_NOLOCK(varshead, ast_var_t);
struct ast_var_t *ast_var_assign(const char *name, const char *value);
void ast_var_delete(struct ast_var_t *var);
char *ast_var_name(struct ast_var_t *var);

View File

@ -369,6 +369,8 @@ struct { \
#define AST_LIST_INSERT_HEAD(head, elm, field) do { \
(elm)->field.next = (head)->first; \
(head)->first = (elm); \
if (!(head)->last) \
(head)->last = (elm); \
} while (0)
/*!

2
pbx.c
View File

@ -6150,7 +6150,7 @@ int load_pbx(void)
ast_verbose( "Asterisk PBX Core Initializing\n");
ast_verbose( "Registering builtin applications:\n");
}
AST_LIST_HEAD_INIT(&globals);
AST_LIST_HEAD_INIT_NOLOCK(&globals);
ast_cli_register_multiple(pbx_cli, sizeof(pbx_cli) / sizeof(pbx_cli[0]));
/* Register builtin applications */

View File

@ -559,7 +559,7 @@ static int dundi_lookup_local(struct dundi_result *dr, struct dundi_mapping *map
dr[anscnt].eid = *us_eid;
dundi_eid_to_str(dr[anscnt].eid_str, sizeof(dr[anscnt].eid_str), &dr[anscnt].eid);
if (ast_test_flag(&flags, DUNDI_FLAG_EXISTS)) {
AST_LIST_HEAD_INIT(&headp);
AST_LIST_HEAD_INIT_NOLOCK(&headp);
newvariable = ast_var_assign("NUMBER", called_number);
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
newvariable = ast_var_assign("EID", dr[anscnt].eid_str);

View File

@ -88,7 +88,7 @@ static char *loopback_helper(char *buf, int buflen, const char *exten, const cha
snprintf(tmp, sizeof(tmp), "%d", priority);
memset(buf, 0, buflen);
AST_LIST_HEAD_INIT(&headp);
AST_LIST_HEAD_INIT_NOLOCK(&headp);
newvariable = ast_var_assign("EXTEN", exten);
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
newvariable = ast_var_assign("CONTEXT", context);