74#define PTHREAD_TIMER_BUCKETS 563
157 "max rate of %d / sec\n",
MAX_RATE);
173 timer->tick_count = 0;
198 if (!
timer->continuous) {
199 timer->continuous =
true;
212 if (
timer->continuous) {
213 timer->continuous =
false;
227 if (
timer->continuous) {
298 if (!
timer->tick_count) {
314 int pending_ticks =
timer->pending_ticks;
318 if (quantity > pending_ticks) {
319 quantity = pending_ticks;
326 timer->pending_ticks -= quantity;
328 if ((0 ==
timer->pending_ticks) && !
timer->continuous) {
340 unsigned char x = 42;
342 if (
timer->pipe_signaled) {
351 timer->pipe_signaled =
true;
362 unsigned long buffer;
364 if (!
timer->pipe_signaled) {
373 timer->pipe_signaled =
false;
387 timer->pending_ticks++;
397 struct timeval next_wakeup =
ast_tvnow();
400 struct timespec ts = { 0, };
406 ts.tv_sec = next_wakeup.tv_sec;
407 ts.tv_nsec = next_wakeup.tv_usec * 1000;
Asterisk main include file. File version handling, generic pbx functions.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
#define ao2_alloc(data_size, destructor_fn)
#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.
static struct ast_timer * timer
Asterisk locking-related definitions:
#define ast_cond_wait(cond, mutex)
#define ast_cond_init(cond, attr)
#define ast_cond_timedwait(cond, mutex, time)
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
pthread_cond_t ast_cond_t
#define ast_mutex_lock(a)
#define ast_cond_signal(cond)
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static void pthread_timer_destructor(void *obj)
static int pthread_timer_disable_continuous(void *data)
static int pthread_timer_enable_continuous(void *data)
static int pthread_timer_hash(const void *obj, const int flags)
static unsigned int pthread_timer_get_max_rate(void *data)
static int init_timing_thread(void)
static int pthread_timer_fd(void *data)
static void * pthread_timer_open(void)
static int run_timer(void *obj, void *arg, int flags)
static void pthread_timer_close(void *data)
static void * do_timing(void *arg)
static void ack_ticks(struct pthread_timer *timer, unsigned int num)
static void unsignal_pipe(struct pthread_timer *timer)
#define PTHREAD_TIMER_BUCKETS
static void signal_pipe(struct pthread_timer *timer)
static int load_module(void)
static void * timing_funcs_handle
static int unload_module(void)
static struct @483 timing_thread
Data for the timing thread.
static int check_timer(struct pthread_timer *timer)
static struct ast_timing_interface pthread_timing
static int pthread_timer_cmp(void *obj, void *arg, int flags)
static int pthread_timer_set_rate(void *data, unsigned int rate)
static int pthread_timer_ack(void *data, unsigned int quantity)
static struct ao2_container * pthread_timers
static enum ast_timer_event pthread_timer_get_event(void *data)
Structure for mutex and tracking information.
unsigned int pending_ticks
enum pthread_timer_state state
Time-related functions and macros.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
Timing source management.
#define ast_register_timing_interface(i)
Register a set of timing functions.
int ast_unregister_timing_interface(void *handle)
Unregister a previously registered timing interface.
@ AST_TIMING_EVENT_CONTINUOUS
@ AST_TIMING_EVENT_EXPIRED
#define ast_pthread_create_background(a, b, c, d)
#define ast_pipe_nonblock(filedes)
Create a non-blocking pipe.