bps_add_sigevent_handler()
Add a sigevent handler to the active channel.
Synopsis:
#include <bps/bps.h>
BPS_API int bps_add_sigevent_handler(struct sigevent *sigevent, int(*sigevent_handler)(void *), void *data)
Arguments:
- sigevent
-
An allocated sigevent that will be filled in by bps_add_sigevent_handler(). A service can then use function like MsgDeliverEvent to signal the callback.
- sigevent_handler
-
The sigevent callback that gets fired whenever the channel receives the corresponding sigevent.
- The first argument will be the data supplied in this function.
- If sigevent_handler returns anything other than EXIT_SUCCESS (0), the callback is removed from the active channel. In addition, subsequent deliveries of the sigevent will not result in a call to sigevent_handler.
- data
-
Service specific data that will be passed into every call to sigevent_handler.
Library:
libbpsDescription:
This function is for situations where a service doesn't have a file descriptor with raw event data. In these cases, services can call bps_add_sigevent_handler() instead of bps_add_fd(). The purpose of the sigevent_handler callback is to push events onto the event queue. This callback has the same purpose as the bps_add_fd() functions's io_handler callback. The difference between the io_handler and sigevent_handler callbacks is that the sigevent_handler is fired whenever the channel receives the sigevent that gets filled in by calling this function and the io_handler gets fired when IO conditions are met for a file descriptor.
Returns:
BPS_SUCCESS if the sigevent_handler was successfully registered, and sigevent was filled in. Otherwise, BPS_FAILURE is returned and the errno value will indicate the type of error. On failure, no callback is registered.