[asterisk-commits] trunk r19062 - in /trunk: .cleancount channel.c
include/asterisk/channel.h
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Apr 10 20:50:20 MST 2006
Author: file
Date: Mon Apr 10 22:50:17 2006
New Revision: 19062
URL: http://svn.digium.com/view/asterisk?rev=19062&view=rev
Log:
Data stores do not need a lock. As well change the way they are removed from the channel when it is destroyed (thanks Russell Wussell) and finally... because C++ is silly... change our list macro info thing to be "entry" instead of "list".
Modified:
trunk/.cleancount
trunk/channel.c
trunk/include/asterisk/channel.h
Modified: trunk/.cleancount
URL: http://svn.digium.com/view/asterisk/trunk/.cleancount?rev=19062&r1=19061&r2=19062&view=diff
==============================================================================
--- trunk/.cleancount (original)
+++ trunk/.cleancount Mon Apr 10 22:50:17 2006
@@ -1,1 +1,1 @@
-14
+15
Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=19062&r1=19061&r2=19062&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Mon Apr 10 22:50:17 2006
@@ -984,16 +984,10 @@
}
/* Get rid of each of the data stores on the channel */
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, list) {
- /* Remove from the list */
- AST_LIST_REMOVE_CURRENT(&chan->datastores, list);
+ while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
/* Free the data store */
ast_channel_datastore_free(datastore);
- }
- AST_LIST_TRAVERSE_SAFE_END
- AST_LIST_UNLOCK(&chan->datastores);
- AST_LIST_HEAD_DESTROY(&chan->datastores);
+ AST_LIST_HEAD_INIT_NOLOCK(&chan->datastores);
/* loop over the variables list, freeing all data and deleting list items */
/* no need to lock the list, as the channel is already locked */
@@ -1059,9 +1053,7 @@
{
int res = 0;
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_INSERT_HEAD(&chan->datastores, datastore, list);
- AST_LIST_UNLOCK(&chan->datastores);
+ AST_LIST_INSERT_HEAD(&chan->datastores, datastore, entry);
return res;
}
@@ -1072,16 +1064,14 @@
int res = -1;
/* Find our position and remove ourselves */
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore2, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore2, entry) {
if (datastore2 == datastore) {
- AST_LIST_REMOVE_CURRENT(&chan->datastores, list);
+ AST_LIST_REMOVE_CURRENT(&chan->datastores, entry);
res = 0;
break;
}
}
AST_LIST_TRAVERSE_SAFE_END
- AST_LIST_UNLOCK(&chan->datastores);
return res;
}
@@ -1093,8 +1083,7 @@
if (info == NULL)
return NULL;
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, entry) {
if (datastore->info == info) {
if (uid != NULL && datastore->uid != NULL) {
if (!strcasecmp(uid, datastore->uid)) {
@@ -1108,7 +1097,6 @@
}
}
AST_LIST_TRAVERSE_SAFE_END
- AST_LIST_UNLOCK(&chan->datastores);
return datastore;
}
@@ -3169,7 +3157,7 @@
}
/* Move data stores over */
if (AST_LIST_FIRST(&clone->datastores))
- AST_LIST_INSERT_TAIL(&original->datastores, AST_LIST_FIRST(&clone->datastores), list);
+ AST_LIST_INSERT_TAIL(&original->datastores, AST_LIST_FIRST(&clone->datastores), entry);
AST_LIST_HEAD_INIT_NOLOCK(&clone->datastores);
clone_variables(original, clone);
Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?rev=19062&r1=19061&r2=19062&view=diff
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Mon Apr 10 22:50:17 2006
@@ -161,7 +161,7 @@
/*! Data store type information */
const struct ast_datastore_info *info;
/*! Used for easy linking */
- AST_LIST_ENTRY(ast_datastore) list;
+ AST_LIST_ENTRY(ast_datastore) entry;
};
/*! Structure for all kinds of caller ID identifications */
@@ -444,7 +444,7 @@
struct ast_channel_spy_list *spies;
/*! Data stores on the channel */
- AST_LIST_HEAD(datastores, ast_datastore) datastores;
+ AST_LIST_HEAD_NOLOCK(datastores, ast_datastore) datastores;
/*! For easy linking */
AST_LIST_ENTRY(ast_channel) chan_list;
More information about the asterisk-commits
mailing list