diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-27 23:14:48 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-27 23:14:48 +0000 |
commit | 7080e02848a60b96c832f0a3de45002165da6cb9 (patch) | |
tree | fe8d41968e18de37ca1f6a42b55f4075ed2cfe51 /include | |
parent | c83caa1ae0033f53e8e51f98415a48f69fb0b349 (diff) |
With the switch to the ast_sched_replace* API in trunk, we lose the correction
that was just merged from 1.4, so this is a changeover to those APIs to use the
macro versions, so that we properly detect errors from ast_sched_del, instead
of simply ignoring the return values.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@100497 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/sched.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h index dbe066310..febcbce94 100644 --- a/include/asterisk/sched.h +++ b/include/asterisk/sched.h @@ -45,6 +45,19 @@ extern "C" { id = -1; \ } while (0); +#define AST_SCHED_REPLACE_VARIABLE(id, sched, when, callback, data, variable) \ + 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__); \ + id = ast_sched_add_variable(sched, when, callback, data, variable); \ + } while (0); + +#define AST_SCHED_REPLACE(id, sched, when, callback, data) \ + AST_SCHED_REPLACE_VARIABLE(id, sched, when, callback, data, 0) + struct sched_context; /*! \brief New schedule context |