freetdm: run sched in the background if requested

This commit is contained in:
Moises Silva
2010-05-27 15:16:03 -04:00
parent 48c7bb320e
commit 22e8a44278
6 changed files with 279 additions and 12 deletions

View File

@@ -40,7 +40,6 @@ FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached(ftdm_thread_function_t fun
FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached_ex(ftdm_thread_function_t func, void *data, ftdm_size_t stack_size);
FT_DECLARE(void) ftdm_thread_override_default_stacksize(ftdm_size_t size);
FT_DECLARE(ftdm_status_t) ftdm_mutex_create(ftdm_mutex_t **mutex);
FT_DECLARE(ftdm_status_t) ftdm_mutex_destroy(ftdm_mutex_t **mutex);

View File

@@ -48,11 +48,14 @@ typedef struct ftdm_timer ftdm_timer_t;
typedef void (*ftdm_sched_callback_t)(void *data);
/*! \brief Create a new scheduling context */
FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched);
FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *name);
/*! \brief Run the schedule to find timers that are expired and run its callbacks */
FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched);
/*! \brief Run the schedule in its own thread. Callbacks will be called in a core thread. You *must* not block there! */
FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched);
/*!
* \brief Schedule a new timer
* \param sched The scheduling context (required)
@@ -82,6 +85,12 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_destroy(ftdm_sched_t **sched);
*/
FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto);
/*! \brief Global initialization, called just once, this is called by FreeTDM core, other users MUST not call it */
FT_DECLARE(ftdm_status_t) ftdm_sched_global_init(void);
/*! \brief Checks if the main scheduling thread is running */
FT_DECLARE(ftdm_bool_t) ftdm_free_sched_running(void);
#ifdef __cplusplus
}
#endif