sd_event_add_defer systemd More text Zbigniew Jędrzejewski-Szmek zbyszek@in.waw.pl sd_event_add_defer 3 sd_event_add_defer sd_event_add_post sd_event_add_exit Add static event sources to an event loop #include <systemd/sd-bus.h> int sd_event_add_defer sd_event *event sd_event_source **source sd_event_handler_t handler void *userdata int sd_event_add_post sd_event *event sd_event_source **source sd_event_handler_t handler void *userdata int sd_event_add_exit sd_event *event sd_event_source **source sd_event_handler_t handler void *userdata typedef int (*sd_event_handler_t) sd_event_source *s void *userdata Description Those three functions add new event sources to an event loop object. The event loop is specified in event, the event source is returned in the source parameter. The event sources are enabled statically and will "fire" when the event loop is run and the conditions described below are met. The handler function will be passed the userdata pointer, which may be chosen freely by the caller. sd_event_add_defer() adds a new event source that will "fire" the next time the event loop is run. By default, the handler will be called once (SD_EVENT_ONESHOT). sd_event_add_post() adds a new event source that will "fire" if any event handlers are invoked whenever the event loop is run. By default, the source is enabled permanently (SD_EVENT_ON). sd_event_add_exit() adds a new event source that will "fire" when the event loop is terminated with sd_event_exit(). The sd_event_source_set_enabled3 function may be used to enable the event source permanently (SD_EVENT_ON) or to make it fire just once (SD_EVENT_ONESHOT). If the handler function returns a negative error code, it will be disabled after the invocation, even if SD_EVENT_ON mode is set. Return Value On success, this functions return 0 or a positive integer. On failure, they return a negative errno-style error code. Errors Returned errors may indicate the following problems: -ENOMEM Not enough memory to allocate an object. -EINVAL An invalid argument has been passed. -ESTALE The event loop is already terminated. -ECHILD The event loop has been created in a different process. Notes Functions described here are available as a shared library, which can be compiled and linked to with the libsystemd pkg-config1 file. See Also systemd1, sd-event3, sd_event_new3, sd_event_add_time3, sd_event_add_signal3, sd_event_add_child3, sd_event_source_set_enabled3