[asterisk-commits] russell: branch russell/events r66960 - in
/team/russell/events: ./ apps/ cha...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Jun 1 16:39:30 MST 2007
Author: russell
Date: Fri Jun 1 18:39:30 2007
New Revision: 66960
URL: http://svn.digium.com/view/asterisk?view=rev&rev=66960
Log:
Merged revisions 66957-66958 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r66957 | russell | 2007-06-01 18:02:57 -0500 (Fri, 01 Jun 2007) | 2 lines
Remove 80 bytes in the iax2_registry struct that weren't being used
........
r66958 | russell | 2007-06-01 18:34:43 -0500 (Fri, 01 Jun 2007) | 16 lines
Merge major changes to the way device state is passed around Asterisk. The two
places that cared about device states were app_queue and the hint code in pbx.c.
The changes include converting it to use the Asterisk event system, as well as
other efficiency improvements.
* app_queue: This module used to register a callback into devicestate.c to
monitor device state changes. Now, it is just a subscriber to Asterisk
events with the type, device state.
* pbx.c hints: Previously, the device state processing thread in devicestate.c
would call ast_hint_state_changed() each time the state of a device changed.
Then, that code would go looking for all the hints that monitor that device,
and call their callbacks. All of this blocked the device state processing
thread. Now, the hint code is a subscriber of Asterisk events with the
type, device state. Furthermore, when this code receives a device state
change event, it queues it up to be processed by another thread so that it
doesn't block one of the event processing threads.
........
Modified:
team/russell/events/ (props changed)
team/russell/events/apps/app_queue.c
team/russell/events/channels/chan_iax2.c
team/russell/events/main/devicestate.c
team/russell/events/main/pbx.c
Propchange: team/russell/events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun 1 18:39:30 2007
@@ -1,1 +1,1 @@
-/trunk:1-66950
+/trunk:1-66958
Modified: team/russell/events/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_queue.c?view=diff&rev=66960&r1=66959&r2=66960
==============================================================================
--- team/russell/events/apps/app_queue.c (original)
+++ team/russell/events/apps/app_queue.c Fri Jun 1 18:39:30 2007
@@ -662,8 +662,6 @@
static int statechange_queue(const char *dev, enum ast_device_state state)
{
- /* Avoid potential for deadlocks by spawning a new thread to handle
- the event */
struct statechange *sc;
if (!(sc = ast_calloc(1, sizeof(*sc) + strlen(dev) + 1)))
Modified: team/russell/events/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_iax2.c?view=diff&rev=66960&r1=66959&r2=66960
==============================================================================
--- team/russell/events/channels/chan_iax2.c (original)
+++ team/russell/events/channels/chan_iax2.c Fri Jun 1 18:39:30 2007
@@ -441,7 +441,6 @@
struct sockaddr_in addr; /*!< Who we connect to for registration purposes */
char username[80];
char secret[80]; /*!< Password or key name in []'s */
- char random[80];
int expire; /*!< Sched ID of expiration */
int refresh; /*!< How often to refresh */
enum iax_reg_state regstate;
Modified: team/russell/events/main/devicestate.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/devicestate.c?view=diff&rev=66960&r1=66959&r2=66960
==============================================================================
--- team/russell/events/main/devicestate.c (original)
+++ team/russell/events/main/devicestate.c Fri Jun 1 18:39:30 2007
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2006, Digium, Inc.
+ * Copyright (C) 1999 - 2007, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
Modified: team/russell/events/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/pbx.c?view=diff&rev=66960&r1=66959&r2=66960
==============================================================================
--- team/russell/events/main/pbx.c (original)
+++ team/russell/events/main/pbx.c Fri Jun 1 18:39:30 2007
@@ -1989,8 +1989,6 @@
static int statechange_queue(const char *dev)
{
- /* Avoid potential for deadlocks by spawning a new thread to handle
- the event */
struct statechange *sc;
if (!(sc = ast_calloc(1, sizeof(*sc) + strlen(dev) + 1)))
@@ -2012,13 +2010,15 @@
while (!device_state.stop) {
ast_mutex_lock(&device_state.lock);
- while (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry)))
+ while (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) {
ast_cond_wait(&device_state.cond, &device_state.lock);
+ /* Check to see if we were woken up to see the request to stop */
+ if (device_state.stop) {
+ ast_mutex_unlock(&device_state.lock);
+ return NULL;
+ }
+ }
ast_mutex_unlock(&device_state.lock);
-
- /* Check to see if we were woken up to see the request to stop */
- if (device_state.stop)
- return NULL;
handle_statechange(sc->dev);
More information about the asterisk-commits
mailing list