Review Board 1.7.16


Various updates to the timing API

Review Request #162 - Created Feb. 16, 2009 and submitted

Russell Bryant
/trunk
Reviewers
asterisk-dev
Asterisk
Now that we have multiple timing modules, only being to load one module is causing some usability issues.  So, that inspired this patch.  I am proposing that this patch go in both trunk and 1.6.1.

1) Add module use count handling so that timing modules can be unloaded.

2) Allow multiple timing modules to be loaded, and use the one with the highest priority value.

3) Report which timing module is being use in the "timing test" CLI command, at the request of Tzafrir on the -dev list.

Note: This patch requires the heap implementation from /r/160/.
It compiles.  "timing test" still works and reports the module I would expect to be in use.

Changes between revision 1 and 2

1 2
1 2

  1. /trunk/include/asterisk/timing.h: Loading...
/trunk/include/asterisk/timing.h
Diff Revision 1 Diff Revision 2
[20] 82 lines
[+20] [+] struct ast_timing_interface {
83
	enum ast_timer_event (*timer_get_event)(int handle);
83
	enum ast_timer_event (*timer_get_event)(int handle);
84
	unsigned int (*timer_get_max_rate)(int handle);
84
	unsigned int (*timer_get_max_rate)(int handle);
85
};
85
};
86

    
   
86

   
87
/*!
87
/*!
88
 * \brief Install a set of timing functions.
88
 * \brief Register a set of timing functions.
89
 *
89
 *
90
 * \param funcs An instance of the \c ast_timer_functions structure with pointers
90
 * \param funcs An instance of the \c ast_timing_interfaces structure with pointers
91
 *        to the functions provided by the timing implementation.
91
 *        to the functions provided by the timing implementation.
92
 *
92
 *
93
 * \retval NULL failure 
93
 * \retval NULL failure 
94
 * \retval non-Null handle to be passed to ast_uninstall_timing_functions() on success
94
 * \retval non-Null handle to be passed to ast_unregister_timing_interface() on success
95
 */
95
 */
96
#define ast_register_timing_interface(i) _ast_register_timing_interface(i, ast_module_info->self)
96
#define ast_register_timing_interface(i) _ast_register_timing_interface(i, ast_module_info->self)
97
void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
97
void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
98
		struct ast_module *mod);
98
		struct ast_module *mod);
99

    
   
99

   
100
/*!
100
/*!
101
 * \brief Uninstall a previously-installed set of timing functions.
101
 * \brief Unregister a previously registered timing interface.
102
 *
102
 *
103
 * \param handle The handle returned from a prior successful call to
103
 * \param handle The handle returned from a prior successful call to
104
 *        ast_install_timing_functions().
104
 *        ast_register_timing_interface().
105
 *
105
 *
106
 * \retval 0 success
106
 * \retval 0 success
107
 * \retval non-zero failure
107
 * \retval non-zero failure
108
 */
108
 */
109
int ast_unregister_timing_interface(void *handle);
109
int ast_unregister_timing_interface(void *handle);
[+20] [20] 95 lines
  1. /trunk/include/asterisk/timing.h: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.