aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-18 17:33:42 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-18 17:33:42 +0000
commit70ab5fa3fce20b7bebc0a55652455f6085b9784f (patch)
treefaf66c80d354058deb3628508e18fdd199b6a6d4 /include
parent422200b6f0f05e9767b9b40f78cd9700395ba703 (diff)
Spinlock within the destroy, to allow a scheduled job to continue, if it's
waiting on the mutex which the destroy thread has. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@132042 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/sched.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h
index 0a601c7b4..5e51529b9 100644
--- a/include/asterisk/sched.h
+++ b/include/asterisk/sched.h
@@ -60,6 +60,22 @@ extern "C" {
(_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); \
+ } \
+ id = -1; \
+ (_sched_res); \
+ })
+
struct sched_context;
/*! \brief New schedule context