Asterisk - The Open Source Telephony Project GIT-master-f36a736
Data Structures | Macros | Functions | Variables
pjsip_scheduler.c File Reference

res_pjsip Scheduler More...

#include "asterisk.h"
#include "asterisk/res_pjsip.h"
#include "include/res_pjsip_private.h"
#include "asterisk/res_pjsip_cli.h"
#include "asterisk/taskprocessor.h"
#include <regex.h>
Include dependency graph for pjsip_scheduler.c:

Go to the source code of this file.

Data Structures

struct  ast_sip_sched_task
 

Macros

#define ID_LEN   13 /* task_deadbeef */
 
#define TASK_BUCKETS   53
 
#define TIME_FORMAT   "%a %T"
 

Functions

 AO2_STRING_FIELD_CMP_FN (ast_sip_sched_task, name)
 
 AO2_STRING_FIELD_HASH_FN (ast_sip_sched_task, name)
 
 AO2_STRING_FIELD_SORT_FN (ast_sip_sched_task, name)
 
int ast_sip_destroy_scheduler (void)
 
int ast_sip_initialize_scheduler (void)
 Initialize scheduler. More...
 
int ast_sip_sched_is_task_running (struct ast_sip_sched_task *schtd)
 Checks if the task is currently running. More...
 
int ast_sip_sched_is_task_running_by_name (const char *name)
 Checks if the task is currently running. More...
 
int ast_sip_sched_task_cancel (struct ast_sip_sched_task *schtd)
 Cancels the next invocation of a task. More...
 
int ast_sip_sched_task_cancel_by_name (const char *name)
 Cancels the next invocation of a task by name. More...
 
int ast_sip_sched_task_get_name (struct ast_sip_sched_task *schtd, char *name, size_t maxlen)
 Gets the task name. More...
 
int ast_sip_sched_task_get_next_run (struct ast_sip_sched_task *schtd)
 Gets the number of milliseconds until the next invocation. More...
 
int ast_sip_sched_task_get_next_run_by_name (const char *name)
 Gets the number of milliseconds until the next invocation. More...
 
int ast_sip_sched_task_get_times (struct ast_sip_sched_task *schtd, struct timeval *queued, struct timeval *last_start, struct timeval *last_end)
 Gets the last start and end times of the task. More...
 
int ast_sip_sched_task_get_times2 (struct ast_sip_sched_task *schtd, struct timeval *queued, struct timeval *last_start, struct timeval *last_end, int *interval, int *time_left, struct timeval *next_start)
 Gets the queued, last start, last_end, time left, interval, next run. More...
 
int ast_sip_sched_task_get_times_by_name (const char *name, struct timeval *queued, struct timeval *last_start, struct timeval *last_end)
 Gets the last start and end times of the task by name. More...
 
int ast_sip_sched_task_get_times_by_name2 (const char *name, struct timeval *queued, struct timeval *last_start, struct timeval *last_end, int *interval, int *time_left, struct timeval *next_start)
 Gets the queued, last start, last_end, time left, interval, next run by task name. More...
 
struct ast_sip_sched_taskast_sip_schedule_task (struct ast_taskprocessor *serializer, int interval, ast_sip_task sip_task, const char *name, void *task_data, enum ast_sip_scheduler_task_flags flags)
 Schedule a task to run in the res_pjsip thread pool. More...
 
static char * cli_show_tasks (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static int push_to_serializer (const void *data)
 
static int run_task (void *data)
 
static void schtd_dtor (void *data)
 

Variables

static struct ast_cli_entry cli_commands []
 
static struct ast_sched_contextscheduler_context
 
static int task_count
 
static struct ao2_containertasks
 

Detailed Description

res_pjsip Scheduler

Author
George Joseph georg.nosp@m.e.jo.nosp@m.seph@.nosp@m.fair.nosp@m.view5.nosp@m..com

Definition in file pjsip_scheduler.c.

Macro Definition Documentation

◆ ID_LEN

#define ID_LEN   13 /* task_deadbeef */

◆ TASK_BUCKETS

#define TASK_BUCKETS   53

Definition at line 35 of file pjsip_scheduler.c.

◆ TIME_FORMAT

#define TIME_FORMAT   "%a %T"

Definition at line 488 of file pjsip_scheduler.c.

Function Documentation

◆ AO2_STRING_FIELD_CMP_FN()

AO2_STRING_FIELD_CMP_FN ( ast_sip_sched_task  ,
name   
)

◆ AO2_STRING_FIELD_HASH_FN()

AO2_STRING_FIELD_HASH_FN ( ast_sip_sched_task  ,
name   
)

◆ AO2_STRING_FIELD_SORT_FN()

AO2_STRING_FIELD_SORT_FN ( ast_sip_sched_task  ,
name   
)

◆ ast_sip_destroy_scheduler()

int ast_sip_destroy_scheduler ( void  )

Definition at line 642 of file pjsip_scheduler.c.

643{
645
646 if (scheduler_context) {
647 if (tasks) {
648 struct ao2_iterator iter;
649 struct ast_sip_sched_task *schtd;
650
651 /* Cancel all scheduled tasks */
652 iter = ao2_iterator_init(tasks, 0);
653 while ((schtd = ao2_iterator_next(&iter))) {
655 ao2_ref(schtd, -1);
656 }
658 }
659
662 }
663
665 tasks = NULL;
666
667 return 0;
668}
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
int ast_sip_sched_task_cancel(struct ast_sip_sched_task *schtd)
Cancels the next invocation of a task.
static struct ast_cli_entry cli_commands[]
static struct ast_sched_context * scheduler_context
static struct ao2_container * tasks
#define NULL
Definition: resample.c:96
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
Definition: sched.c:271
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821
#define ARRAY_LEN(a)
Definition: utils.h:666

References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sched_context_destroy(), ast_sip_sched_task_cancel(), cli_commands, NULL, scheduler_context, and tasks.

Referenced by load_module(), and unload_module().

◆ ast_sip_initialize_scheduler()

int ast_sip_initialize_scheduler ( void  )

Initialize scheduler.

Since
13.9.0
Return values
-1failure
0success

Definition at line 614 of file pjsip_scheduler.c.

615{
617 if (!scheduler_context) {
618 ast_log(LOG_ERROR, "Failed to create scheduler. Aborting load\n");
619 return -1;
620 }
621
623 ast_log(LOG_ERROR, "Failed to start scheduler. Aborting load\n");
625 return -1;
626 }
627
629 AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, TASK_BUCKETS, ast_sip_sched_task_hash_fn,
630 ast_sip_sched_task_sort_fn, ast_sip_sched_task_cmp_fn);
631 if (!tasks) {
632 ast_log(LOG_ERROR, "Failed to allocate task container. Aborting load\n");
634 return -1;
635 }
636
638
639 return 0;
640}
#define ast_log
Definition: astobj2.c:42
@ AO2_ALLOC_OPT_LOCK_RWLOCK
Definition: astobj2.h:365
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
Definition: astobj2.h:1303
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT
Reject objects with duplicate keys in container.
Definition: astobj2.h:1188
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
#define LOG_ERROR
#define TASK_BUCKETS
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
Definition: sched.c:197
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
Definition: sched.c:238

References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), cli_commands, LOG_ERROR, scheduler_context, TASK_BUCKETS, and tasks.

Referenced by load_module().

◆ cli_show_tasks()

static char * cli_show_tasks ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
)
static

Definition at line 490 of file pjsip_scheduler.c.

491{
492 struct ao2_iterator iter;
493 struct ao2_container *sorted_tasks;
494 struct ast_sip_sched_task *schtd;
495 struct ast_tm tm;
496 char times_run[16];
497 char queued[32];
498 char last_start[32];
499 char next_start[32];
500 struct timeval now;
501 int using_regex = 0;
502 regex_t regex;
503
504 switch (cmd) {
505 case CLI_INIT:
506 e->command = "pjsip show scheduled_tasks";
507 e->usage = "Usage: pjsip show scheduled_tasks [ like <pattern> ]\n"
508 " Show scheduled pjsip tasks\n";
509 return NULL;
510 case CLI_GENERATE:
511 return NULL;
512 }
513
514 if (a->argc != 3 && a->argc != 5) {
515 return CLI_SHOWUSAGE;
516 }
517
518 if (a->argc == 5) {
519 int regrc;
520 if (strcasecmp(a->argv[3], "like")) {
521 return CLI_SHOWUSAGE;
522 }
523 regrc = regcomp(&regex, a->argv[4], REG_EXTENDED | REG_ICASE | REG_NOSUB);
524 if (regrc) {
525 char err[256];
526 regerror(regrc, &regex, err, 256);
527 ast_cli(a->fd, "PJSIP Scheduled Tasks: Error: %s\n", err);
528 return CLI_FAILURE;
529 }
530 using_regex = 1;
531 }
532
533 /* Get a sorted snapshot of the scheduled tasks */
535 ast_sip_sched_task_sort_fn, NULL);
536 if (!sorted_tasks) {
537 ast_cli(a->fd, "PJSIP Scheduled Tasks: Unable to allocate temporary container\n");
538 return CLI_FAILURE;
539 }
540 if (ao2_container_dup(sorted_tasks, tasks, 0)) {
541 ao2_ref(sorted_tasks, -1);
542 ast_cli(a->fd, "PJSIP Scheduled Tasks: Unable to sort temporary container\n");
543 return CLI_FAILURE;
544 }
545
546 now = ast_tvnow();
547
548 ast_localtime(&now, &tm, NULL);
549
550 ast_cli(a->fd, "PJSIP Scheduled Tasks:\n\n");
551
552 ast_cli(a->fd,
553 "<Task Name....................................> <Interval> <Times Run> <State>"
554 " <Queued....> <Last Start> <Next Start.....secs>\n"
555 "=============================================================================="
556 "===================================================\n");
557
558 iter = ao2_iterator_init(sorted_tasks, AO2_ITERATOR_UNLINK);
559 for (; (schtd = ao2_iterator_next(&iter)); ao2_ref(schtd, -1)) {
560 int next_run_sec;
561 struct timeval next;
562
563 ao2_lock(schtd);
564
565 if (using_regex && regexec(&regex, schtd->name, 0, NULL, 0) == REG_NOMATCH) {
566 ao2_unlock(schtd);
567 continue;
568 }
569
570 next_run_sec = ast_sip_sched_task_get_next_run(schtd) / 1000;
571 if (next_run_sec < 0) {
572 /* Scheduled task is now canceled */
573 ao2_unlock(schtd);
574 continue;
575 }
576 next = ast_tvadd(now, ast_tv(next_run_sec, 0));
577
578 ast_localtime(&schtd->when_queued, &tm, NULL);
579 ast_strftime(queued, sizeof(queued), TIME_FORMAT, &tm);
580
581 ast_localtime(&schtd->last_start, &tm, NULL);
582 ast_strftime(last_start, sizeof(last_start), TIME_FORMAT, &tm);
583
584 ast_localtime(&next, &tm, NULL);
585 ast_strftime(next_start, sizeof(next_start), TIME_FORMAT, &tm);
586
587 sprintf(times_run, "%d", schtd->run_count);
588
589 ast_cli(a->fd, "%-46.46s %9d %9s %-5s %-12s %-12s %-12s %8d\n",
590 schtd->name,
591 schtd->interval / 1000,
592 schtd->flags & AST_SIP_SCHED_TASK_ONESHOT ? "oneshot" : times_run,
593 schtd->is_running ? "run" : "wait",
594 queued,
595 (ast_tvzero(schtd->last_start) || (schtd->flags & AST_SIP_SCHED_TASK_ONESHOT) ? "" : last_start),
596 next_start,
597 next_run_sec);
598 ao2_unlock(schtd);
599 }
600 if (using_regex) {
601 regfree(&regex);
602 }
604 ast_cli(a->fd, "\nTotal Scheduled Tasks: %d\n\n", ao2_container_count(sorted_tasks));
605 ao2_ref(sorted_tasks, -1);
606
607 return CLI_SUCCESS;
608}
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags)
Copy all object references in the src container into the dest container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
Definition: astobj2.h:367
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
@ AO2_ITERATOR_UNLINK
Definition: astobj2.h:1863
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a red-black tree container.
Definition: astobj2.h:1349
#define ao2_unlock(a)
Definition: astobj2.h:729
#define ao2_lock(a)
Definition: astobj2.h:717
#define CLI_SHOWUSAGE
Definition: cli.h:45
#define CLI_SUCCESS
Definition: cli.h:44
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
@ CLI_INIT
Definition: cli.h:152
@ CLI_GENERATE
Definition: cli.h:153
#define CLI_FAILURE
Definition: cli.h:46
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
int ast_sip_sched_task_get_next_run(struct ast_sip_sched_task *schtd)
Gets the number of milliseconds until the next invocation.
@ AST_SIP_SCHED_TASK_ONESHOT
Definition: res_pjsip.h:2086
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Definition: localtime.c:1739
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
Definition: localtime.c:2524
#define TIME_FORMAT
Generic container type.
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
struct timeval last_start
struct timeval when_queued
enum ast_sip_scheduler_task_flags flags
static struct test_val a
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
Definition: time.h:117
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Definition: extconf.c:2282
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
Definition: time.h:235

References a, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_rbtree, ao2_container_count(), ao2_container_dup(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), ast_localtime(), ast_sip_sched_task_get_next_run(), AST_SIP_SCHED_TASK_ONESHOT, ast_strftime(), ast_tv(), ast_tvadd(), ast_tvnow(), ast_tvzero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_sip_sched_task::flags, ast_sip_sched_task::interval, ast_sip_sched_task::is_running, ast_sip_sched_task::last_start, ast_sip_sched_task::name, NULL, regex(), ast_sip_sched_task::run_count, tasks, TIME_FORMAT, ast_cli_entry::usage, and ast_sip_sched_task::when_queued.

◆ push_to_serializer()

static int push_to_serializer ( const void *  data)
static

Definition at line 157 of file pjsip_scheduler.c.

158{
159 struct ast_sip_sched_task *schtd = (struct ast_sip_sched_task *)data;
160 int sched_id;
161
162 ao2_lock(schtd);
164 schtd->current_scheduler_id = -1;
165 ao2_unlock(schtd);
166 if (sched_id < 0) {
167 /* Task was cancelled while waiting on the lock */
168 return 0;
169 }
170
171 if (schtd->flags & AST_SIP_SCHED_TASK_TRACK) {
172 ast_log(LOG_DEBUG, "Sched %p: Ready to run %s\n", schtd, schtd->name);
173 }
174 ao2_t_ref(schtd, +1, "Give ref to run_task()");
175 if (ast_sip_push_task(schtd->serializer, run_task, schtd)) {
176 /*
177 * Oh my. Have to cancel the scheduled item because we
178 * unexpectedly cannot run it anymore.
179 */
180 ao2_unlink(tasks, schtd);
181 ao2_lock(schtd);
182 schtd->interval = 0;
183 ao2_unlock(schtd);
184
185 ao2_t_ref(schtd, -1, "Failed so release run_task() ref");
186 }
187
188 return 0;
189}
#define ao2_t_ref(o, delta, tag)
Definition: astobj2.h:460
#define ao2_unlink(container, obj)
Remove an object from a container.
Definition: astobj2.h:1578
int ast_sip_push_task(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Pushes a task to SIP servants.
Definition: res_pjsip.c:2099
@ AST_SIP_SCHED_TASK_TRACK
The scheduled task's events are tracked in the debug log.
Definition: res_pjsip.h:2125
#define LOG_DEBUG
static int run_task(void *data)
struct ast_taskprocessor * serializer
Scheduler ID holder.
Definition: sched.c:70

References ao2_lock, ao2_t_ref, ao2_unlink, ao2_unlock, ast_log, ast_sip_push_task(), AST_SIP_SCHED_TASK_TRACK, ast_sip_sched_task::current_scheduler_id, ast_sip_sched_task::flags, ast_sip_sched_task::interval, LOG_DEBUG, ast_sip_sched_task::name, run_task(), ast_sip_sched_task::serializer, and tasks.

Referenced by ast_sip_schedule_task(), and run_task().

◆ run_task()

static int run_task ( void *  data)
static

Definition at line 80 of file pjsip_scheduler.c.

81{
82 RAII_VAR(struct ast_sip_sched_task *, schtd, data, ao2_cleanup);
83 int res;
84 int delay;
85
86 if (!schtd->interval) {
87 /* Task was cancelled while waiting to be executed by the serializer */
88 return -1;
89 }
90
91 if (schtd->flags & AST_SIP_SCHED_TASK_TRACK) {
92 ast_log(LOG_DEBUG, "Sched %p: Running %s\n", schtd, schtd->name);
93 }
94 ao2_lock(schtd);
95 schtd->last_start = ast_tvnow();
96 schtd->is_running = 1;
97 ++schtd->run_count;
98 ao2_unlock(schtd);
99
100 res = schtd->task(schtd->task_data);
101
102 ao2_lock(schtd);
103 schtd->is_running = 0;
104 schtd->last_end = ast_tvnow();
105
106 /*
107 * Don't restart if the task returned <= 0 or if the interval
108 * was set to 0 while the task was running
109 */
110 if ((schtd->flags & AST_SIP_SCHED_TASK_ONESHOT) || res <= 0 || !schtd->interval) {
111 schtd->interval = 0;
112 ao2_unlock(schtd);
113 ao2_unlink(tasks, schtd);
114 return -1;
115 }
116
117 if (schtd->flags & AST_SIP_SCHED_TASK_VARIABLE) {
118 schtd->interval = res;
119 }
120
121 if (schtd->flags & AST_SIP_SCHED_TASK_DELAY) {
122 delay = schtd->interval;
123 } else {
124 int64_t diff;
125
126 /* Determine next periodic interval we need to expire. */
127 do {
128 schtd->next_periodic = ast_tvadd(schtd->next_periodic,
129 ast_samp2tv(schtd->interval, 1000));
130 diff = ast_tvdiff_ms(schtd->next_periodic, schtd->last_end);
131 } while (diff <= 0);
132 delay = diff;
133 }
134
135 schtd->current_scheduler_id = ast_sched_add(scheduler_context, delay, push_to_serializer, schtd);
136 if (schtd->current_scheduler_id < 0) {
137 schtd->interval = 0;
138 ao2_unlock(schtd);
139 ast_log(LOG_ERROR, "Sched %p: Failed to reschedule task %s\n", schtd, schtd->name);
140 ao2_unlink(tasks, schtd);
141 return -1;
142 }
143
144 ao2_unlock(schtd);
145 if (schtd->flags & AST_SIP_SCHED_TASK_TRACK) {
146 ast_log(LOG_DEBUG, "Sched %p: Rescheduled %s for %d ms\n", schtd, schtd->name,
147 delay);
148 }
149
150 return 0;
151}
@ AST_SIP_SCHED_TASK_DELAY
The next invocation of the task is at last finish + interval.
Definition: res_pjsip.h:2118
@ AST_SIP_SCHED_TASK_VARIABLE
Definition: res_pjsip.h:2080
static int push_to_serializer(const void *data)
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
Definition: sched.c:567
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
Definition: time.h:282
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References ao2_cleanup, ao2_lock, ao2_unlink, ao2_unlock, ast_log, ast_samp2tv(), ast_sched_add(), AST_SIP_SCHED_TASK_DELAY, AST_SIP_SCHED_TASK_ONESHOT, AST_SIP_SCHED_TASK_TRACK, AST_SIP_SCHED_TASK_VARIABLE, ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), LOG_DEBUG, LOG_ERROR, push_to_serializer(), RAII_VAR, scheduler_context, and tasks.

Referenced by push_to_serializer().

◆ schtd_dtor()

static void schtd_dtor ( void *  data)
static

Definition at line 399 of file pjsip_scheduler.c.

400{
401 struct ast_sip_sched_task *schtd = data;
402
403 if (schtd->flags & AST_SIP_SCHED_TASK_TRACK) {
404 ast_log(LOG_DEBUG, "Sched %p: Destructor %s\n", schtd, schtd->name);
405 }
406 if (schtd->flags & AST_SIP_SCHED_TASK_DATA_AO2) {
407 /* release our own ref, then release the callers if asked to do so */
408 ao2_ref(schtd->task_data, (schtd->flags & AST_SIP_SCHED_TASK_DATA_FREE) ? -2 : -1);
409 } else if (schtd->task_data && (schtd->flags & AST_SIP_SCHED_TASK_DATA_FREE)) {
410 ast_free(schtd->task_data);
411 }
413}
#define ast_free(a)
Definition: astmm.h:180
@ AST_SIP_SCHED_TASK_DATA_AO2
Definition: res_pjsip.h:2097
@ AST_SIP_SCHED_TASK_DATA_FREE
Definition: res_pjsip.h:2107
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.

References ao2_ref, ast_free, ast_log, AST_SIP_SCHED_TASK_DATA_AO2, AST_SIP_SCHED_TASK_DATA_FREE, AST_SIP_SCHED_TASK_TRACK, ast_taskprocessor_unreference(), ast_sip_sched_task::flags, LOG_DEBUG, ast_sip_sched_task::name, ast_sip_sched_task::serializer, and ast_sip_sched_task::task_data.

Referenced by ast_sip_schedule_task().

Variable Documentation

◆ cli_commands

struct ast_cli_entry cli_commands[]
static
Initial value:
= {
{ .handler = cli_show_tasks , .summary = "Show pjsip scheduled tasks" ,},
}
static char * cli_show_tasks(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)

Definition at line 610 of file pjsip_scheduler.c.

Referenced by ast_sip_destroy_scheduler(), and ast_sip_initialize_scheduler().

◆ scheduler_context

struct ast_sched_context* scheduler_context
static

◆ task_count

int task_count
static

Definition at line 39 of file pjsip_scheduler.c.

Referenced by ast_sip_schedule_task().

◆ tasks

struct ao2_container* tasks
static