[Asterisk-cvs] asterisk sched.c,1.22,1.23
kpfleming
kpfleming
Mon Aug 22 18:53:01 CDT 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv10195
Modified Files:
sched.c
Log Message:
add preliminary support for SIP timers (issue #4359)
Index: sched.c
===================================================================
RCS file: /usr/cvsroot/asterisk/sched.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- sched.c 15 Jul 2005 23:00:46 -0000 1.22
+++ sched.c 22 Aug 2005 22:55:06 -0000 1.23
@@ -42,6 +42,7 @@
int id; /* ID number of event */
struct timeval when; /* Absolute time event should take place */
int resched; /* When to reschedule */
+ int variable; /* Use return value from callback to reschedule */
void *data; /* Data */
ast_sched_cb callback; /* Callback */
};
@@ -209,7 +210,8 @@
return 0;
}
-int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data)
+
+int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable)
{
/*
* Schedule callback(data) to happen when ms into the future
@@ -227,6 +229,7 @@
tmp->callback = callback;
tmp->data = data;
tmp->resched = when;
+ tmp->variable = variable;
tmp->when = ast_tv(0, 0);
if (sched_settime(&tmp->when, when)) {
sched_release(con, tmp);
@@ -243,6 +246,11 @@
return res;
}
+int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data)
+{
+ return ast_sched_add_variable(con, when, callback, data, 0);
+}
+
int ast_sched_del(struct sched_context *con, int id)
{
/*
@@ -359,7 +367,7 @@
* If they return non-zero, we should schedule them to be
* run again.
*/
- if (sched_settime(¤t->when, current->resched)) {
+ if (sched_settime(¤t->when, current->variable? res : current->resched)) {
sched_release(con, current);
} else
schedule(con, current);
More information about the svn-commits
mailing list