aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-07-08 14:35:57 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-07-08 14:35:57 +0000
commit1191562945bd297f501b4e4831ba75c6c111dfdc (patch)
tree262bbb4990da1d277302af279945995fc140a750 /include
parent4be59ee6b7f3144836088b46bef136d589952585 (diff)
SIP Dialog ref counting
This patch adds reference counting for sip dialogs into 1.6.0. When proc_session_timer() is called from the scheduler thread it has no guarantee the session timer's dialog won't be freed from underneath it. Now the session timer holds a reference to the dialog, preventing it from being destroyed during the middle of proc_session_timer(). (closes issue #13623) Reported by: Nik Soggia Review: https://reviewboard.asterisk.org/r/302/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@205117 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/sched.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h
index 3d249d200..4c67b333d 100644
--- a/include/asterisk/sched.h
+++ b/include/asterisk/sched.h
@@ -58,6 +58,24 @@ extern "C" {
id = -1; \
} while (0);
+/*!
+ * \brief schedule task to get deleted and call unref function
+ * \sa AST_SCHED_DEL
+ * \since 1.6.0
+ */
+#define AST_SCHED_DEL_UNREF(sched, id, refcall) \
+ do { \
+ int _count = 0; \
+ while (id > -1 && ast_sched_del(sched, id) && ++_count < 10) { \
+ usleep(1); \
+ } \
+ if (_count == 10) \
+ ast_log(LOG_WARNING, "Unable to cancel schedule ID %d. This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
+ if (id > -1) \
+ refcall; \
+ id = -1; \
+ } while (0);
+
#define AST_SCHED_REPLACE_VARIABLE(id, sched, when, callback, data, variable) \
do { \
int _count = 0; \