| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include "asterisk.h" |
| 20 |
|
| 21 |
#include "asterisk/astobj2.h" |
| 22 |
#include "asterisk/sched.h" |
| 23 |
|
| 24 |
#include "general.h" |
| 25 |
|
| 26 |
|
| 27 |
static struct ast_sched_context *sched = NULL; |
| 28 |
|
| 29 |
struct ast_sched_context *aeap_sched_context(void) |
| 30 |
{ |
| 31 |
return sched; |
| 32 |
} |
| 33 |
|
| 34 |
void aeap_general_finalize(void) |
| 35 |
{ |
| 36 |
if (sched) { |
| 37 |
ast_sched_context_destroy(sched); |
| 38 |
sched = NULL; |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
int aeap_general_initialize(void) |
| 43 |
{ |
| 44 |
sched = ast_sched_context_create(); |
| 45 |
if (!sched) { |
| 46 |
ast_log(LOG_ERROR, "AEAP scheduler: unable to create context"); |
| 47 |
return -1; |
| 48 |
} |
| 49 |
|
| 50 |
if (ast_sched_start_thread(sched)) { |
| 51 |
ast_log(LOG_ERROR, "AEAP scheduler: unable to start thread"); |
| 52 |
aeap_general_finalize(); |
| 53 |
return -1; |
| 54 |
} |
| 55 |
|
| 56 |
return 0; |
| 57 |
} |
| 58 |
|