summaryrefslogtreecommitdiff
path: root/res/res_timing_dahdi.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2009-02-17 21:22:40 +0000
committerRussell Bryant <russell@russellbryant.com>2009-02-17 21:22:40 +0000
commitc461d29b0bfb1dee8be097fd11513000e44d3f09 (patch)
tree970a76c529a8b43ee7d90a826d405bbe41d54e2e /res/res_timing_dahdi.c
parent6f9e69adad78f9de8ecf5a315f9850bb5bbb576c (diff)
Update the timing API to have better support for multiple timing interfaces.
1) Add module use count handling so that timing modules can be unloaded. 2) Implement unload_module() functions for the timing interface modules. 3) Allow multiple timing modules to be loaded, and use the one with the highest priority value. 4) Report which timing module is being use in the "timing test" CLI command. (closes issue #14489) Reported by: russell Review: http://reviewboard.digium.com/r/162/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176666 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_timing_dahdi.c')
-rw-r--r--res/res_timing_dahdi.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/res/res_timing_dahdi.c b/res/res_timing_dahdi.c
index 1e1150bfe..bb0b72679 100644
--- a/res/res_timing_dahdi.c
+++ b/res/res_timing_dahdi.c
@@ -25,8 +25,6 @@
/*** MODULEINFO
<depend>dahdi</depend>
- <conflict>res_timing_timerfd</conflict>
- <conflict>res_timing_pthread</conflict>
***/
#include "asterisk.h"
@@ -52,10 +50,12 @@ static int dahdi_timer_set_rate(int handle, unsigned int rate);
static void dahdi_timer_ack(int handle, unsigned int quantity);
static int dahdi_timer_enable_continuous(int handle);
static int dahdi_timer_disable_continuous(int handle);
-static enum ast_timing_event dahdi_timer_get_event(int handle);
+static enum ast_timer_event dahdi_timer_get_event(int handle);
static unsigned int dahdi_timer_get_max_rate(int handle);
-static struct ast_timing_functions dahdi_timing_functions = {
+static struct ast_timing_interface dahdi_timing = {
+ .name = "DAHDI",
+ .priority = 100,
.timer_open = dahdi_timer_open,
.timer_close = dahdi_timer_close,
.timer_set_rate = dahdi_timer_set_rate,
@@ -112,7 +112,7 @@ static int dahdi_timer_disable_continuous(int handle)
return ioctl(handle, DAHDI_TIMERPONG, &flags) ? -1 : 0;
}
-static enum ast_timing_event dahdi_timer_get_event(int handle)
+static enum ast_timer_event dahdi_timer_get_event(int handle)
{
int res;
int event;
@@ -184,17 +184,13 @@ static int load_module(void)
return AST_MODULE_LOAD_DECLINE;
}
- return (timing_funcs_handle = ast_install_timing_functions(&dahdi_timing_functions)) ?
+ return (timing_funcs_handle = ast_register_timing_interface(&dahdi_timing)) ?
AST_MODULE_LOAD_SUCCESS : AST_MODULE_LOAD_DECLINE;
}
static int unload_module(void)
{
- /* ast_uninstall_timing_functions(timing_funcs_handle); */
-
- /* This module can not currently be unloaded. No use count handling is being done. */
-
- return -1;
+ return ast_unregister_timing_interface(timing_funcs_handle);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "DAHDI Timing Interface");