Debian Codegraph @

upstream/debian-unstable/man3/sd_event_source_unref.3

raw
1 '\" t
2 .TH "SD_EVENT_SOURCE_UNREF" "3" "" "systemd 261~rc3" "sd_event_source_unref"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_event_source_unref, sd_event_source_unrefp, sd_event_source_ref, sd_event_source_disable_unref, sd_event_source_disable_unrefp \- Increase or decrease event source reference counters
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-event\&.h>
29 .fi
30 .ft
31 .HP \w'sd_event_source*\ sd_event_source_unref('u
32 .BI "sd_event_source* sd_event_source_unref(sd_event_source\ *" "source" ");"
33 .HP \w'void\ sd_event_source_unrefp('u
34 .BI "void sd_event_source_unrefp(sd_event_source\ **" "source" ");"
35 .HP \w'sd_event_source*\ sd_event_source_ref('u
36 .BI "sd_event_source* sd_event_source_ref(sd_event_source\ *" "source" ");"
37 .HP \w'sd_event_source*\ sd_event_source_disable_unref('u
38 .BI "sd_event_source* sd_event_source_disable_unref(sd_event_source\ *" "source" ");"
39 .HP \w'void\ sd_event_source_disable_unrefp('u
40 .BI "void sd_event_source_disable_unrefp(sd_event_source\ **" "source" ");"
41 .SH "DESCRIPTION"
42 .PP
43 \fBsd_event_source_unref()\fR
44 may be used to decrement by one the internal reference counter of the event source object specified as
45 \fIsource\fR\&. The reference counter is initially set to one, when the event source is created with calls such as
46 \fBsd_event_add_io\fR(3)
47 or
48 \fBsd_event_add_time\fR(3)\&. When the reference counter reaches zero, the object is detached from the event loop object and destroyed\&.
49 .PP
50 \fBsd_event_source_unrefp()\fR
51 is similar to
52 \fBsd_event_source_unref()\fR
53 but takes a pointer to a pointer to an
54 \fBsd_event_source\fR
55 object\&. This call is useful in conjunction with GCC\*(Aqs and LLVM\*(Aqs
56 \m[blue]\fBClean\-up Variable Attribute\fR\m[]\&\s-2\u[1]\d\s+2\&. Note that this function is defined as inline function\&.
57 .PP
58 \fBsd_event_source_ref()\fR
59 may be used to increase by one the internal reference counter of the event source object specified as
60 \fIsource\fR\&.
61 .PP
62 \fBsd_event_source_unref()\fR,
63 \fBsd_bus_creds_unrefp()\fR
64 and
65 \fBsd_bus_creds_ref()\fR
66 execute no operation if the passed event source object is
67 \fBNULL\fR\&.
68 .PP
69 Note that event source objects stay alive and may be dispatched as long as they have a reference counter greater than zero\&. In order to drop a reference of an event source and make sure the associated event source handler function is not called anymore it is recommended to combine a call of
70 \fBsd_event_source_unref()\fR
71 with a prior call to
72 \fBsd_event_source_set_enabled()\fR
73 with
74 \fBSD_EVENT_OFF\fR
75 or call
76 \fBsd_event_source_disable_unref()\fR, see below\&.
77 .PP
78 \fBsd_event_source_disable_unref()\fR
79 combines a call to
80 \fBsd_event_source_set_enabled()\fR
81 with
82 \fBSD_EVENT_OFF\fR
83 with
84 \fBsd_event_source_unref()\fR\&. This ensures that the source is disabled before the local reference to it is lost\&. The
85 \fIsource\fR
86 parameter is allowed to be
87 \fBNULL\fR\&.
88 .PP
89 \fBsd_event_source_disable_unrefp()\fR
90 is similar to
91 \fBsd_event_source_unrefp()\fR, but in addition disables the source first\&. This call is useful in conjunction with GCC\*(Aqs and LLVM\*(Aqs
92 \m[blue]\fBClean\-up Variable Attribute\fR\m[]\&\s-2\u[1]\d\s+2\&. Note that this function is defined as inline function\&.
93 .SH "RETURN VALUE"
94 .PP
95 \fBsd_event_source_unref()\fR
96 and
97 \fBsd_event_source_disable_unref()\fR
98 always return
99 \fBNULL\fR\&.
100 \fBsd_event_source_ref()\fR
101 always returns the event source object passed in\&.
102 .SH "NOTES"
103 .PP
104 Functions described here are available as a shared library, which can be compiled against and linked to with the
105 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
106 file\&.
107 .PP
108 The code described here uses
109 \fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
110 \fBsetenv\fR(3)
111 from a parallel thread\&. It is recommended to only do calls to
112 \fBsetenv()\fR
113 from an early phase of the program when no other threads have been started\&.
114 .SH "HISTORY"
115 .PP
116 \fBsd_event_source_unref()\fR,
117 \fBsd_event_source_unrefp()\fR, and
118 \fBsd_event_source_ref()\fR
119 were added in version 229\&.
120 .PP
121 \fBsd_event_source_disable_unref()\fR
122 and
123 \fBsd_event_source_disable_unrefp()\fR
124 were added in version 243\&.
125 .SH "SEE ALSO"
126 .PP
127 \fBsd-event\fR(3), \fBsd_event_add_io\fR(3), \fBsd_event_add_time\fR(3), \fBsd_event_add_signal\fR(3), \fBsd_event_add_child\fR(3), \fBsd_event_add_inotify\fR(3), \fBsd_event_add_defer\fR(3), \fBsd_event_source_set_enabled\fR(3)
128 .SH "NOTES"
129 .IP " 1." 4
130 Clean-up Variable Attribute
131 .RS 4
132 \%https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
133 .RE