summaryrefslogtreecommitdiff
path: root/include/asterisk/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk/sched.h')
-rw-r--r--include/asterisk/sched.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h
index b16421a88..aac6dc82b 100644
--- a/include/asterisk/sched.h
+++ b/include/asterisk/sched.h
@@ -56,6 +56,19 @@ extern "C" {
(_sched_res); \
})
+#define AST_SCHED_DEL_ACCESSOR(sched, obj, getter, setter) \
+ ({ \
+ int _count = 0; \
+ int _sched_res = -1; \
+ while (getter(obj) > -1 && (_sched_res = ast_sched_del(sched, getter(obj))) && ++_count < 10) \
+ usleep(1); \
+ if (_count == 10) { \
+ ast_debug(3, "Unable to cancel schedule ID %d.\n", getter(obj)); \
+ } \
+ setter(obj, -1); \
+ (_sched_res); \
+ })
+
/*!
* \brief schedule task to get deleted and call unref function
* \sa AST_SCHED_DEL