mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
add softtimer to the core, begin framework for static modules and reduces calls to gettimeofday for timestamps
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5784 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -152,6 +152,10 @@ struct switch_runtime {
|
||||
uint8_t running;
|
||||
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||
uint32_t flags;
|
||||
switch_time_t timestamp;
|
||||
switch_mutex_t *throttle_mutex;
|
||||
uint32_t sps_total;
|
||||
int32_t sps;
|
||||
};
|
||||
|
||||
extern struct switch_runtime runtime;
|
||||
|
||||
@@ -252,6 +252,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(const char *console
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit);
|
||||
|
||||
/*!
|
||||
\brief Set/Get Session Rate Limit
|
||||
\param new_limit new value (if > 0)
|
||||
\return the current session rate limit
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(uint32_t new_limit);
|
||||
|
||||
/*!
|
||||
\brief Destroy the core
|
||||
\note to be called at application shutdown
|
||||
@@ -1464,6 +1471,7 @@ SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, sw
|
||||
|
||||
SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name);
|
||||
SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname);
|
||||
SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void);
|
||||
///\}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -120,13 +120,16 @@ SWITCH_DECLARE(switch_dialplan_interface_t *) switch_loadable_module_get_dialpla
|
||||
\param switch_module_load the function to call when the module is loaded
|
||||
\param switch_module_runtime a function requested to be started in it's own thread once loaded
|
||||
\param switch_module_shutdown the function to call when the system is shutdown
|
||||
\param runtime start the runtime thread or not
|
||||
\return the resulting status
|
||||
\note only use this function if you are making a module that in turn gateways module loading to another technology
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
|
||||
switch_module_load_t switch_module_load,
|
||||
switch_module_runtime_t switch_module_runtime,
|
||||
switch_module_shutdown_t switch_module_shutdown);
|
||||
switch_module_shutdown_t switch_module_shutdown,
|
||||
switch_bool_t runtime);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Retrieve the timer interface by it's registered name
|
||||
@@ -312,6 +315,11 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void);
|
||||
|
||||
///\}
|
||||
|
||||
#define SWITCH_DECLARE_STATIC_MODULE(init, load, run, shut) void init(void) { \
|
||||
switch_loadable_module_build_dynamic(__FILE__, load, run, shut, SWITCH_FALSE); \
|
||||
}
|
||||
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
|
||||
Reference in New Issue
Block a user