summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2014-02-07 20:01:45 +0000
committerJoshua Colp <jcolp@digium.com>2014-02-07 20:01:45 +0000
commite8e2f91bbac77ca50dddc4a496512475990a8764 (patch)
treefdbb590820a386771e01916e9dbd7809bd187232 /include
parent5fd63e2d0beeae4e118a7567716b586899166090 (diff)
timing: Improve performance for most timing implementations.
This change allows timing implementation data to be stored directly on the timer itself thus removing the requirement for many implementations to do a container lookup for the same information. This means that API calls into timing implementations can directly access the information they need instead of having to find it. Review: https://reviewboard.asterisk.org/r/3175/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/timing.h61
1 files changed, 31 insertions, 30 deletions
diff --git a/include/asterisk/timing.h b/include/asterisk/timing.h
index 9cbb0eba1..ff4947a0a 100644
--- a/include/asterisk/timing.h
+++ b/include/asterisk/timing.h
@@ -18,33 +18,33 @@
*/
/*!
- \file timing.h
- \brief Timing source management
- \author Kevin P. Fleming <kpfleming@digium.com>
- \author Russell Bryant <russell@digium.com>
+ \file timing.h
+ \brief Timing source management
+ \author Kevin P. Fleming <kpfleming@digium.com>
+ \author Russell Bryant <russell@digium.com>
- Portions of Asterisk require a timing source, a periodic trigger
- for media handling activities. The functions in this file allow
- a loadable module to provide a timing source for Asterisk and its
- modules, so that those modules can request a 'timing handle' when
- they require one. These handles are file descriptors, which can be
- used with select() or poll().
+ Portions of Asterisk require a timing source, a periodic trigger
+ for media handling activities. The functions in this file allow
+ a loadable module to provide a timing source for Asterisk and its
+ modules, so that those modules can request a 'timing handle' when
+ they require one. These handles are file descriptors, which can be
+ used with select() or poll().
- The timing source used by Asterisk must provide the following
- features:
+ The timing source used by Asterisk must provide the following
+ features:
- 1) Periodic triggers, with a configurable interval (specified as
- number of triggers per second).
+ 1) Periodic triggers, with a configurable interval (specified as
+ number of triggers per second).
- 2) Multiple outstanding triggers, each of which must be 'acked'
- to clear it. Triggers must also be 'ackable' in quantity.
+ 2) Multiple outstanding triggers, each of which must be 'acked'
+ to clear it. Triggers must also be 'ackable' in quantity.
- 3) Continuous trigger mode, which when enabled causes every call
- to poll() on the timer handle to immediately return.
+ 3) Continuous trigger mode, which when enabled causes every call
+ to poll() on the timer handle to immediately return.
- 4) Multiple 'event types', so that the code using the timer can
- know whether the wakeup it received was due to a periodic trigger
- or a continuous trigger.
+ 4) Multiple 'event types', so that the code using the timer can
+ know whether the wakeup it received was due to a periodic trigger
+ or a continuous trigger.
*/
#ifndef _ASTERISK_TIMING_H
@@ -71,14 +71,15 @@ struct ast_timing_interface {
/*! This handles the case where multiple timing modules are loaded.
* The highest priority timing interface available will be used. */
unsigned int priority;
- int (*timer_open)(void);
- void (*timer_close)(int handle);
- int (*timer_set_rate)(int handle, unsigned int rate);
- int (*timer_ack)(int handle, unsigned int quantity);
- int (*timer_enable_continuous)(int handle);
- int (*timer_disable_continuous)(int handle);
- enum ast_timer_event (*timer_get_event)(int handle);
- unsigned int (*timer_get_max_rate)(int handle);
+ void *(*timer_open)(void);
+ void (*timer_close)(void *data);
+ int (*timer_set_rate)(void *data, unsigned int rate);
+ int (*timer_ack)(void *data, unsigned int quantity);
+ int (*timer_enable_continuous)(void *data);
+ int (*timer_disable_continuous)(void *data);
+ enum ast_timer_event (*timer_get_event)(void *data);
+ unsigned int (*timer_get_max_rate)(void *data);
+ int (*timer_fd)(void *data);
};
/*!
@@ -93,7 +94,7 @@ struct ast_timing_interface {
*/
#define ast_register_timing_interface(i) _ast_register_timing_interface(i, ast_module_info->self)
void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
- struct ast_module *mod);
+ struct ast_module *mod);
/*!
* \brief Unregister a previously registered timing interface.