Apache2
|
Macros | |
#define | AP_WATCHDOG_SINGLETON "_singleton_" |
#define | AP_WATCHDOG_DEFAULT "_default_" |
#define | AP_WD_TM_INTERVAL APR_TIME_C(1000000) /* 1 second */ |
#define | AP_WD_TM_SLICE APR_TIME_C(100000) /* 100 ms */ |
#define | AP_WATCHDOG_STATE_STARTING 1 |
#define | AP_WATCHDOG_STATE_RUNNING 2 |
#define | AP_WATCHDOG_STATE_STOPPING 3 |
#define | AP_WD_DECLARE(type) type |
#define | AP_WD_DECLARE_NONSTD(type) type |
#define | AP_WD_DECLARE_DATA |
Typedefs | |
typedef struct ap_watchdog_t | ap_watchdog_t |
typedef apr_status_t | ap_watchdog_callback_fn_t(int state, void *data, apr_pool_t *pool) |
Functions | |
apr_status_t | ap_watchdog_get_instance (ap_watchdog_t **watchdog, const char *name, int parent, int singleton, apr_pool_t *p) |
apr_status_t | ap_watchdog_register_callback (ap_watchdog_t *watchdog, apr_interval_time_t interval, const void *data, ap_watchdog_callback_fn_t *callback) |
apr_status_t | ap_watchdog_set_callback_interval (ap_watchdog_t *w, apr_interval_time_t interval, const void *data, ap_watchdog_callback_fn_t *callback) |
int | ap_hook_watchdog_need (server_rec *s, const char *name, int parent, int singleton) |
int | ap_hook_watchdog_init (server_rec *s, const char *name, apr_pool_t *pool) |
int | ap_hook_watchdog_exit (server_rec *s, const char *name, apr_pool_t *pool) |
int | ap_hook_watchdog_step (server_rec *s, const char *name, apr_pool_t *pool) |
#define AP_WATCHDOG_DEFAULT "_default_" |
Default watchdog instance name
#define AP_WATCHDOG_SINGLETON "_singleton_" |
Default singleton watchdog instance name. Singleton watchdog is protected by mutex and guaranteed to be run inside a single child process at any time.
#define AP_WATCHDOG_STATE_RUNNING 2 |
#define AP_WATCHDOG_STATE_STARTING 1 |
#define AP_WATCHDOG_STATE_STOPPING 3 |
#define AP_WD_DECLARE | ( | type | ) | type |
#define AP_WD_DECLARE_DATA |
#define AP_WD_DECLARE_NONSTD | ( | type | ) | type |
#define AP_WD_TM_INTERVAL APR_TIME_C(1000000) /* 1 second */ |
Default Watchdog interval
#define AP_WD_TM_SLICE APR_TIME_C(100000) /* 100 ms */ |
Watchdog thread timer resolution
typedef apr_status_t ap_watchdog_callback_fn_t(int state, void *data, apr_pool_t *pool) |
Callback function used for watchdog.
state | Watchdog state function. See AP_WATCHDOG_STATE_ . |
data | is what was passed to ap_watchdog_register_callback function. |
pool | Temporary callback pool destroyed after the call. |
typedef struct ap_watchdog_t ap_watchdog_t |
int ap_hook_watchdog_exit | ( | server_rec * | s, |
const char * | name, | ||
apr_pool_t * | pool | ||
) |
Watchdog terminate hook. It is called when the watchdog thread is terminated.
s | The server record |
name | Watchdog name. |
pool | The pool used to create the watchdog. |
int ap_hook_watchdog_init | ( | server_rec * | s, |
const char * | name, | ||
apr_pool_t * | pool | ||
) |
Watchdog initialize hook. It is called after the watchdog thread is initialized.
s | The server record |
name | Watchdog name. |
pool | The pool used to create the watchdog. |
int ap_hook_watchdog_need | ( | server_rec * | s, |
const char * | name, | ||
int | parent, | ||
int | singleton | ||
) |
Watchdog require hook.
s | The server record |
name | Watchdog name. |
parent | Non-zero to indicate the parent process watchdog mode. |
singleton | Non-zero to indicate the singleton watchdog mode. |
int ap_hook_watchdog_step | ( | server_rec * | s, |
const char * | name, | ||
apr_pool_t * | pool | ||
) |
Fixed interval watchdog hook. It is called regularly on AP_WD_TM_INTERVAL
interval.
s | The server record |
name | Watchdog name. |
pool | Temporary pool destroyed after the call. |
apr_status_t ap_watchdog_get_instance | ( | ap_watchdog_t ** | watchdog, |
const char * | name, | ||
int | parent, | ||
int | singleton, | ||
apr_pool_t * | p | ||
) |
Get watchdog instance.
watchdog | Storage for watchdog instance. |
name | Watchdog name. |
parent | Non-zero to get the parent process watchdog instance. |
singleton | Non-zero to get the singleton watchdog instance. |
p | The pool to use. |
AP_WATCHDOG_DEFAULT
to get default watchdog instance. If separate watchdog thread is needed provide unique name and function will create a new watchdog instance. Note that default client process watchdog works in singleton mode. apr_status_t ap_watchdog_register_callback | ( | ap_watchdog_t * | watchdog, |
apr_interval_time_t | interval, | ||
const void * | data, | ||
ap_watchdog_callback_fn_t * | callback | ||
) |
Register watchdog callback.
watchdog | Watchdog to use |
interval | Interval on which the callback function will execute. |
callback | The function to call on watchdog event. |
data | The data to pass to the callback function. |
apr_status_t ap_watchdog_set_callback_interval | ( | ap_watchdog_t * | w, |
apr_interval_time_t | interval, | ||
const void * | data, | ||
ap_watchdog_callback_fn_t * | callback | ||
) |
Update registered watchdog callback interval.
w | Watchdog to use |
interval | New interval on which the callback function will execute. |
callback | The function to call on watchdog event. |
data | The data to pass to the callback function. |