[asterisk-commits] russell: branch russell/chan_refcount r82300 - /team/russell/chan_refcount/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 12 17:41:13 CDT 2007
Author: russell
Date: Wed Sep 12 17:41:12 2007
New Revision: 82300
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82300
Log:
more changes from the 1.4 version
Modified:
team/russell/chan_refcount/main/channel.c
Modified: team/russell/chan_refcount/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/channel.c?view=diff&rev=82300&r1=82299&r2=82300
==============================================================================
--- team/russell/chan_refcount/main/channel.c (original)
+++ team/russell/chan_refcount/main/channel.c Wed Sep 12 17:41:12 2007
@@ -341,29 +341,28 @@
return res;
}
+static int ast_channel_softhangup_cb(void *obj, void *arg, int flags)
+{
+ struct ast_channel *chan = obj;
+
+ ast_softhangup(chan, AST_SOFTHANGUP_SHUTDOWN);
+
+ return 0;
+}
+
/*! \brief Initiate system shutdown */
void ast_begin_shutdown(int hangup)
{
- struct ast_channel *c;
shutting_down = 1;
- if (hangup) {
- AST_RWLIST_RDLOCK(&channels);
- AST_RWLIST_TRAVERSE(&channels, c, chan_list)
- ast_softhangup(c, AST_SOFTHANGUP_SHUTDOWN);
- AST_RWLIST_UNLOCK(&channels);
- }
+
+ if (hangup)
+ ao2_callback(channels, OBJ_NODATA, ast_channel_softhangup_cb, NULL);
}
/*! \brief returns number of active/allocated channels */
int ast_active_channels(void)
{
- struct ast_channel *c;
- int cnt = 0;
- AST_RWLIST_RDLOCK(&channels);
- AST_RWLIST_TRAVERSE(&channels, c, chan_list)
- cnt++;
- AST_RWLIST_UNLOCK(&channels);
- return cnt;
+ return ao2_container_count(channels);
}
/*! \brief Cancel a shutdown in progress */
More information about the asterisk-commits
mailing list