1SD_EVENT_SOURCE_SET_DEsSdT_ReOvYe_nCtA_LsLoBuArCcKe(_3s)etS_Dd_eEsVtErNoTy__ScOaUlRlCbEa_cSkET_DESTROY_CALLBACK(3)
2
3
4
6 sd_event_source_set_destroy_callback,
7 sd_event_source_get_destroy_callback, sd_event_destroy_t - Define the
8 callback function for resource cleanup.
9
11 #include <systemd/sd-event.h>
12
13 typedef int (*sd_event_destroy_t)(void *userdata);
14
15 int sd_event_source_set_destroy_callback(sd_event_source *source,
16 sd_event_destroy_t callback);
17
18 int sd_event_source_get_destroy_callback(sd_event_source *source,
19 sd_event_destroy_t *callback);
20
22 sd_event_source_set_destroy_callback() sets callback as the callback
23 function to be called right before the event source object source is
24 deallocated. The userdata pointer from the event source object will be
25 passed as the userdata parameter. This pointer can be set by an
26 argument to the constructor functions, see sd_event_add_io(3), or
27 directly, see sd_event_source_set_userdata(3). This callback function
28 is called even if userdata is NULL. Note that this callback is invoked
29 at a time where the event source object itself is already invalidated,
30 and executing operations or taking new references to the event source
31 object is not permissible.
32
33 sd_event_source_get_destroy_callback() returns the current callback for
34 source in the callback parameter.
35
37 On success, sd_event_source_set_destroy_callback() returns 0 or a
38 positive integer. On failure, it returns a negative errno-style error
39 code.
40
41 sd_event_source_get_destroy_callback() returns positive if the destroy
42 callback function is set, 0 if not. On failure, returns a negative
43 errno-style error code.
44
45 Errors
46 Returned errors may indicate the following problems:
47
48 -EINVAL
49 The source parameter is NULL.
50
52 These APIs are implemented as a shared library, which can be compiled
53 and linked to with the libsystemd pkg-config(1) file.
54
56 systemd(1), sd-event(3), sd_event_add_io(3), sd_event_add_time(3),
57 sd_event_add_signal(3), sd_event_add_child(3), sd_event_add_inotify(3),
58 sd_event_add_defer(3), sd_event_source_set_userdata(3)
59
60
61
62systemd 245 SD_EVENT_SOURCE_SET_DESTROY_CALLBACK(3)