[asterisk-commits] tilghman: branch 1.4 r132042 - in /branches/1.4: channels/ include/asterisk/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 18 12:33:43 CDT 2008
Author: tilghman
Date: Fri Jul 18 12:33:42 2008
New Revision: 132042
URL: http://svn.digium.com/view/asterisk?view=rev&rev=132042
Log:
Spinlock within the destroy, to allow a scheduled job to continue, if it's
waiting on the mutex which the destroy thread has.
Modified:
branches/1.4/channels/chan_iax2.c
branches/1.4/include/asterisk/sched.h
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=132042&r1=132041&r2=132042
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Fri Jul 18 12:33:42 2008
@@ -1306,8 +1306,8 @@
}
}
if (!owner && iaxs[callno]) {
- AST_SCHED_DEL(sched, iaxs[callno]->lagid);
- AST_SCHED_DEL(sched, iaxs[callno]->pingid);
+ AST_SCHED_DEL_SPINLOCK(sched, iaxs[callno]->lagid, &iaxsl[callno]);
+ AST_SCHED_DEL_SPINLOCK(sched, iaxs[callno]->pingid, &iaxsl[callno]);
iaxs[callno] = NULL;
}
Modified: branches/1.4/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/sched.h?view=diff&rev=132042&r1=132041&r2=132042
==============================================================================
--- branches/1.4/include/asterisk/sched.h (original)
+++ branches/1.4/include/asterisk/sched.h Fri Jul 18 12:33:42 2008
@@ -53,6 +53,22 @@
int _sched_res = -1; \
while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) \
usleep(1); \
+ if (_count == 10 && option_debug > 2) { \
+ ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
+ } \
+ id = -1; \
+ (_sched_res); \
+ })
+
+#define AST_SCHED_DEL_SPINLOCK(sched, id, lock) \
+ ({ \
+ int _count = 0; \
+ int _sched_res = -1; \
+ while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) { \
+ ast_mutex_unlock(lock); \
+ usleep(1); \
+ ast_mutex_lock(lock); \
+ } \
if (_count == 10 && option_debug > 2) { \
ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
} \
More information about the asterisk-commits
mailing list