mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-10 14:51:09 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@100497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user