Asterisk - The Open Source Telephony Project GIT-master-7e7a603
general.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2021, Sangoma Technologies Corporation
5 *
6 * Kevin Harwell <kharwell@sangoma.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19#include "asterisk.h"
20
21#include "asterisk/astobj2.h"
22#include "asterisk/sched.h"
23
24#include "general.h"
25
26/*! \brief Scheduler for transaction timeouts */
27static struct ast_sched_context *sched = NULL;
28
30{
31 return sched;
32}
33
35{
36 if (sched) {
38 sched = NULL;
39 }
40}
41
43{
45 if (!sched) {
46 ast_log(LOG_ERROR, "AEAP scheduler: unable to create context");
47 return -1;
48 }
49
51 ast_log(LOG_ERROR, "AEAP scheduler: unable to start thread");
53 return -1;
54 }
55
56 return 0;
57}
58
Asterisk main include file. File version handling, generic pbx functions.
#define ast_log
Definition: astobj2.c:42
static struct ast_sched_context * sched
Scheduler for transaction timeouts.
Definition: general.c:27
int aeap_general_initialize(void)
Initialize general/common AEAP facilities.
Definition: general.c:42
void aeap_general_finalize(void)
Finalize/cleanup general AEAP facilities.
Definition: general.c:34
struct ast_sched_context * aeap_sched_context(void)
Retrieve the scheduling context.
Definition: general.c:29
#define LOG_ERROR
#define NULL
Definition: resample.c:96
Scheduler Routines (derived from cheops)
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
Definition: sched.c:271
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
Definition: sched.c:76