qbloop.h.3 | qbloop.h.3 | |||
---|---|---|---|---|
qbloop.h(3) libqb qbloop .h(3) | qbloop.h(3) libqb qbloop .h(3) | |||
NAME | NAME | |||
qbloop.h - | qbloop.h - | |||
Main loop manages timers, jobs and polling sockets. | Main loop manages timers, jobs and polling sockets'. | |||
SYNOPSIS | SYNOPSIS | |||
#include <signal.h> | #include <signal.h> | |||
#include <stdint.h> | ||||
Typedefs | Typedefs | |||
typedef struct qb_loop qb_loop_t | typedef struct qb_loop qb_loop_t | |||
An opaque data type representing the main loop. | An opaque data type representing the main loop'. | |||
typedef uint64_t qb_loop_timer_handle | typedef uint64_t qb_loop_timer_handle | |||
typedef void * qb_loop_signal_handle | typedef void * qb_loop_signal_handle | |||
typedef int32_t(* qb_loop_poll_dispatch_fn )(int32_t fd, int32_t rev ents, void *data) | typedef int32_t(* qb_loop_poll_dispatch_fn )(int32_t fd, int32_t rev ents, void *data) | |||
typedef void(* qb_loop_job_dispatch_fn )(void *data) | typedef void(* qb_loop_job_dispatch_fn )(void *data) | |||
typedef void(* qb_loop_timer_dispatch_fn )(void *data) | typedef void(* qb_loop_timer_dispatch_fn )(void *data) | |||
typedef int32_t(* qb_loop_signal_dispatch_fn )(int32_t rsignal, void *data) | typedef int32_t(* qb_loop_signal_dispatch_fn )(int32_t rsignal, void *data) | |||
typedef void(* qb_loop_poll_low_fds_event_fn )(int32_t not_enough, i nt32_t fds_available) | typedef void(* qb_loop_poll_low_fds_event_fn )(int32_t not_enough, i nt32_t fds_available) | |||
Enumerations | Enumerations | |||
enum qb_loop_priority { QB_LOOP_LOW = 0, QB_LOOP_MED = 1, QB_LOOP_ HIGH = 2 } | enum qb_loop_priority { QB_LOOP_LOW = 0, QB_LOOP_MED = 1, QB_LOOP_ HIGH = 2 } | |||
Priorites for jobs, timers & poll. | Priorites for jobs, timers & poll'. | |||
Functions | Functions | |||
qb_loop_t * qb_loop_create (void) | qb_loop_t * qb_loop_create (void) | |||
Create a new main loop. | Create a new main loop'. | |||
void qb_loop_destroy (struct qb_loop *l) | void qb_loop_destroy (struct qb_loop *l) | |||
void qb_loop_stop (qb_loop_t *l) | void qb_loop_stop (qb_loop_t *l) | |||
Stop the main loop. | Stop the main loop'. | |||
void qb_loop_run (qb_loop_t *l) | void qb_loop_run (qb_loop_t *l) | |||
Run the main loop. | Run the main loop'. | |||
int32_t qb_loop_job_add (qb_loop_t *l, enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn) | int32_t qb_loop_job_add (qb_loop_t *l, enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn) | |||
Add a job to the mainloop. | Add a job to the mainloop'. | |||
int32_t qb_loop_timer_add (qb_loop_t *l, enum qb_loop_priority p, ui nt64_t nsec_duration, void *data, qb_loop_timer_dispatch_fn dispatch_fn, qb _loop_timer_handle *timer_handle_out) | int32_t qb_loop_timer_add (qb_loop_t *l, enum qb_loop_priority p, ui nt64_t nsec_duration, void *data, qb_loop_timer_dispatch_fn dispatch_fn, qb _loop_timer_handle *timer_handle_out) | |||
Add a timer to the mainloop. | Add a timer to the mainloop'. | |||
int32_t qb_loop_timer_del (qb_loop_t *l, qb_loop_timer_handle th) | int32_t qb_loop_timer_del (qb_loop_t *l, qb_loop_timer_handle th) | |||
Delete a timer that is still outstanding. | Delete a timer that is still outstanding'. | |||
uint64_t qb_loop_timer_expire_time_get (struct qb_loop *l, qb_loop_t imer_handle th) | uint64_t qb_loop_timer_expire_time_get (struct qb_loop *l, qb_loop_t imer_handle th) | |||
Get the time remaining before it expires. | Get the time remaining before it expires'. | |||
int32_t qb_loop_poll_low_fds_event_set (qb_loop_t *l, qb_loop_poll_l ow_fds_event_fn fn) | int32_t qb_loop_poll_low_fds_event_set (qb_loop_t *l, qb_loop_poll_l ow_fds_event_fn fn) | |||
Set a callback to receive events on file descriptors getting low . | Set a callback to receive events on file descriptors getting low '. | |||
int32_t qb_loop_poll_add (qb_loop_t *l, enum qb_loop_priority p, int 32_t fd, int32_t events, void *data, qb_loop_poll_dispatch_fn dispatch_fn) | int32_t qb_loop_poll_add (qb_loop_t *l, enum qb_loop_priority p, int 32_t fd, int32_t events, void *data, qb_loop_poll_dispatch_fn dispatch_fn) | |||
Add a poll job to the mainloop. | Add a poll job to the mainloop'. | |||
int32_t qb_loop_poll_mod (qb_loop_t *l, enum qb_loop_priority p, int 32_t fd, int32_t events, void *data, qb_loop_poll_dispatch_fn dispatch_fn) | int32_t qb_loop_poll_mod (qb_loop_t *l, enum qb_loop_priority p, int 32_t fd, int32_t events, void *data, qb_loop_poll_dispatch_fn dispatch_fn) | |||
Modify a poll job. | Modify a poll job'. | |||
int32_t qb_loop_poll_del (qb_loop_t *l, int32_t fd) | int32_t qb_loop_poll_del (qb_loop_t *l, int32_t fd) | |||
Delete a poll job. | Delete a poll job'. | |||
int32_t qb_loop_signal_add (qb_loop_t *l, enum qb_loop_priority p, i nt32_t signal, void *data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_ signal_handle *handle) | int32_t qb_loop_signal_add (qb_loop_t *l, enum qb_loop_priority p, i nt32_t signal, void *data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_ signal_handle *handle) | |||
Add a signal job. | Add a signal job'. | |||
int32_t qb_loop_signal_mod (qb_loop_t *l, enum qb_loop_priority p, i nt32_t signal, void *data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_ signal_handle handle) | int32_t qb_loop_signal_mod (qb_loop_t *l, enum qb_loop_priority p, i nt32_t signal, void *data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_ signal_handle handle) | |||
Modify the signal job. | Modify the signal job'. | |||
int32_t qb_loop_signal_del (qb_loop_t *l, qb_loop_signal_handle hand le) | int32_t qb_loop_signal_del (qb_loop_t *l, qb_loop_signal_handle hand le) | |||
Delete the signal job. | Delete the signal job'. | |||
Detailed Description | Detailed Description | |||
Main loop manages timers, jobs and polling sockets. | Main loop manages timers, jobs and polling sockets'. | |||
Typedef Documentation | Typedef Documentation | |||
typedef void(* qb_loop_job_dispatch_fn)(void *data) | typedef void(* qb_loop_job_dispatch_fn)(void *data) | |||
typedef int32_t(* qb_loop_poll_dispatch_fn)(int32_t fd, int32_t revents, void *data) | typedef int32_t(* qb_loop_poll_dispatch_fn)(int32_t fd, int32_t revents, void *data) | |||
typedef void(* qb_loop_poll_low_fds_event_fn)(int32_t not_enough, int32_ t fds_available) | typedef void(* qb_loop_poll_low_fds_event_fn)(int32_t not_enough, int32_ t fds_available) | |||
typedef int32_t(* qb_loop_signal_dispatch_fn)(int32_t rsignal, void *dat a) | typedef int32_t(* qb_loop_signal_dispatch_fn)(int32_t rsignal, void *dat a) | |||
typedef void* qb_loop_signal_handle | typedef void* qb_loop_signal_handle | |||
typedef struct qb_loop qb_loop_t | typedef struct qb_loop qb_loop_t | |||
An opaque data type representing the main loop. | An opaque data type representing the main loop'. | |||
typedef void(* qb_loop_timer_dispatch_fn)(void *data) | typedef void(* qb_loop_timer_dispatch_fn)(void *data) | |||
typedef uint64_t qb_loop_timer_handle | typedef uint64_t qb_loop_timer_handle | |||
Enumeration Type Documentation | Enumeration Type Documentation | |||
enum qb_loop_priority | enum qb_loop_priority | |||
Priorites for jobs, timers & poll. | Priorites for jobs, timers & poll'. | |||
Enumerator: | Enumerator: | |||
QB_LOOP_LOW | QB_LOOP_LOW | |||
QB_LOOP_MED | QB_LOOP_MED | |||
QB_LOOP_HIGH | QB_LOOP_HIGH | |||
Function Documentation | Function Documentation | |||
qb_loop_t* qb_loop_create (void) | qb_loop_t* qb_loop_create (void) | |||
Create a new main loop. Returns: | Create a new main loop'. Returns: | |||
loop instance. | loop instance'. | |||
void qb_loop_destroy (struct qb_loop * l) | void qb_loop_destroy (struct qb_loop *l) | |||
int32_t qb_loop_job_add (qb_loop_t * l, enum qb_loop_priority p, void * | int32_t qb_loop_job_add (qb_loop_t *l, enum qb_loop_priorityp, void *dat | |||
data, qb_loop_job_dispatch_fn dispatch_fn) | a, qb_loop_job_dispatch_fndispatch_fn) | |||
Add a job to the mainloop. This is run in the next cycle of the loop | Add a job to the mainloop'. This is run in the next cycle of the loo | |||
. | p'. | |||
Note: | Note: | |||
it is a one-shot job. | it is a one-shot job'. | |||
Parameters: | Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
p the priority | p the priority | |||
data user data passed into the dispatch function | data user data passed into the dispatch function | |||
dispatch_fn callback function | dispatch_fn callback function | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_poll_add (qb_loop_t * l, enum qb_loop_priority p, int32_ | int32_t qb_loop_poll_add (qb_loop_t *l, enum qb_loop_priorityp, int32_tf | |||
t fd, int32_t events, void * data, qb_loop_poll_dispatch_fn dispatch_fn) | d, int32_tevents, void *data, qb_loop_poll_dispatch_fndispatch_fn) | |||
Add a poll job to the mainloop. Note: | Add a poll job to the mainloop'. Note: | |||
it is a re-occuring job. | it is a re-occuring job'. | |||
Parameters: | Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
p the priority | p the priority | |||
fd file descriptor. | fd file descriptor'. | |||
events (POLLIN|POLLOUT) etc .... | events (POLLIN|POLLOUT) etc '.'.'.'. | |||
data user data passed into the dispatch function | data user data passed into the dispatch function | |||
dispatch_fn callback function | dispatch_fn callback function | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_poll_del (qb_loop_t * l, int32_t fd) | int32_t qb_loop_poll_del (qb_loop_t *l, int32_tfd) | |||
Delete a poll job. Parameters: | Delete a poll job'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
fd file descriptor. | fd file descriptor'. | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_poll_low_fds_event_set (qb_loop_t * l, qb_loop_poll_low_ | int32_t qb_loop_poll_low_fds_event_set (qb_loop_t *l, qb_loop_poll_low_f | |||
fds_event_fn fn) | ds_event_fnfn) | |||
Set a callback to receive events on file descriptors getting low. Pa | Set a callback to receive events on file descriptors getting low'. P | |||
rameters: | arameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
fn callback function. | fn callback function'. | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_poll_mod (qb_loop_t * l, enum qb_loop_priority p, int32_ | int32_t qb_loop_poll_mod (qb_loop_t *l, enum qb_loop_priorityp, int32_tf | |||
t fd, int32_t events, void * data, qb_loop_poll_dispatch_fn dispatch_fn) | d, int32_tevents, void *data, qb_loop_poll_dispatch_fndispatch_fn) | |||
Modify a poll job. Parameters: | Modify a poll job'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
p the priority | p the priority | |||
fd file descriptor. | fd file descriptor'. | |||
events (POLLIN|POLLOUT) etc .... | events (POLLIN|POLLOUT) etc '.'.'.'. | |||
data user data passed into the dispatch function | data user data passed into the dispatch function | |||
dispatch_fn callback function | dispatch_fn callback function | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
void qb_loop_run (qb_loop_t * l) | void qb_loop_run (qb_loop_t *l) | |||
Run the main loop. Parameters: | Run the main loop'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
int32_t qb_loop_signal_add (qb_loop_t * l, enum qb_loop_priority p, int3 | int32_t qb_loop_signal_add (qb_loop_t *l, enum qb_loop_priorityp, int32_ | |||
2_t signal, void * data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_si | tsignal, void *data, qb_loop_signal_dispatch_fndispatch_fn, qb_loop_signal_ | |||
gnal_handle * handle) | handle *handle) | |||
Add a signal job. Get a callback on this signal (not in the context | Add a signal job'. Get a callback on this signal (not in the context | |||
of the signal). | of the signal)'. | |||
Parameters: | Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
p the priority | p the priority | |||
signal (SIGHUP or SIGINT) etc .... | signal (SIGHUP or SIGINT) etc '.'.'.'. | |||
data user data passed into the dispatch function | data user data passed into the dispatch function | |||
dispatch_fn callback function | dispatch_fn callback function | |||
handle (out) a reference to the signal job | handle (out) a reference to the signal job | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_signal_del (qb_loop_t * l, qb_loop_signal_handle handle) | int32_t qb_loop_signal_del (qb_loop_t *l, qb_loop_signal_handlehandle) | |||
Delete the signal job. Parameters: | Delete the signal job'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
handle (in) a reference to the signal job | handle (in) a reference to the signal job | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_signal_mod (qb_loop_t * l, enum qb_loop_priority p, int3 | int32_t qb_loop_signal_mod (qb_loop_t *l, enum qb_loop_priorityp, int32_ | |||
2_t signal, void * data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_si | tsignal, void *data, qb_loop_signal_dispatch_fndispatch_fn, qb_loop_signal_ | |||
gnal_handle handle) | handlehandle) | |||
Modify the signal job. Parameters: | Modify the signal job'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
p the priority | p the priority | |||
signal (SIGHUP or SIGINT) etc .... | signal (SIGHUP or SIGINT) etc '.'.'.'. | |||
data user data passed into the dispatch function | data user data passed into the dispatch function | |||
dispatch_fn callback function | dispatch_fn callback function | |||
handle (in) a reference to the signal job | handle (in) a reference to the signal job | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
void qb_loop_stop (qb_loop_t * l) | void qb_loop_stop (qb_loop_t *l) | |||
Stop the main loop. Parameters: | Stop the main loop'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
int32_t qb_loop_timer_add (qb_loop_t * l, enum qb_loop_priority p, uint6 | int32_t qb_loop_timer_add (qb_loop_t *l, enum qb_loop_priorityp, uint64_ | |||
4_t nsec_duration, void * data, qb_loop_timer_dispatch_fn dispatch_fn, qb_l | tnsec_duration, void *data, qb_loop_timer_dispatch_fndispatch_fn, qb_loop_t | |||
oop_timer_handle * timer_handle_out) | imer_handle *timer_handle_out) | |||
Add a timer to the mainloop. Note: | Add a timer to the mainloop'. Note: | |||
it is a one-shot job. | it is a one-shot job'. | |||
Parameters: | Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
p the priority | p the priority | |||
nsec_duration nano-secs in the future to run the dispatch. | nsec_duration nano-secs in the future to run the dispatch'. | |||
data user data passed into the dispatch function | data user data passed into the dispatch function | |||
dispatch_fn callback function | dispatch_fn callback function | |||
timer_handle_out handle to delete the timer if needed. | timer_handle_out handle to delete the timer if needed'. | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
int32_t qb_loop_timer_del (qb_loop_t * l, qb_loop_timer_handle th) | int32_t qb_loop_timer_del (qb_loop_t *l, qb_loop_timer_handleth) | |||
Delete a timer that is still outstanding. Parameters: | Delete a timer that is still outstanding'. Parameters: | |||
l pointer to the loop instance | l pointer to the loop instance | |||
th handle to delete the timer if needed. | th handle to delete the timer if needed'. | |||
Returns: | Returns: | |||
status (0 == ok, -errno == failure) | status (0 == ok, -errno == failure) | |||
uint64_t qb_loop_timer_expire_time_get (struct qb_loop * l, qb_loop_time | uint64_t qb_loop_timer_expire_time_get (struct qb_loop *l, qb_loop_timer | |||
r_handle th) | _handleth) | |||
Get the time remaining before it expires. Parameters: | Get the time remaining before it expires'. Note: | |||
if the timer has already expired it will return 0 | ||||
Parameters: | ||||
l pointer to the loop instance | l pointer to the loop instance | |||
th timer handle. | th timer handle'. | |||
Returns: | Returns: | |||
nano seconds left | nano seconds left | |||
Author | Author | |||
Generated automatically by Doxygen for libqb from the source code. | Generated automatically by Doxygen for libqb from the source code'. | |||
Version 0.4.1 Mon Jan 31 2011 qbloop .h(3) | Version 0.8.1 Thu Jan 5 2012 qbloop .h(3) | |||
End of changes. 48 change blocks. | ||||
79 lines changed or deleted | 83 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |