1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
'\" t
.TH "SD_EVENT_SOURCE_UNREF" "3" "" "systemd 241" "sd_event_source_unref"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
sd_event_source_unref, sd_event_source_unrefp, sd_event_source_ref \- Increase or decrease event source reference counters
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <systemd/sd\-event\&.h>
.fi
.ft
.HP \w'sd_event_source*\ sd_event_source_unref('u
.BI "sd_event_source* sd_event_source_unref(sd_event_source\ *" "source" ");"
.HP \w'void\ sd_event_source_unrefp('u
.BI "void sd_event_source_unrefp(sd_event_source\ **" "source" ");"
.HP \w'sd_event_source*\ sd_event_source_ref('u
.BI "sd_event_source* sd_event_source_ref(sd_event_source\ *" "source" ");"
.SH "DESCRIPTION"
.PP
\fBsd_event_source_unref()\fR
may be used to decrement by one the reference counter of the event source object specified as
\fIsource\fR\&. The reference counter is initially set to one, when the event source is created with calls such as
\fBsd_event_add_io\fR(3)
or
\fBsd_event_add_time\fR(3)\&. When the reference counter reaches zero it is removed from its event loop object and destroyed\&.
.PP
\fBsd_event_source_unrefp()\fR
is similar to
\fBsd_event_source_unref()\fR
but takes a pointer to a pointer to an
\fBsd_event_source\fR
object\&. This call is useful in conjunction with GCC\*(Aqs and LLVM\*(Aqs
\m[blue]\fBClean\-up Variable Attribute\fR\m[]\&\s-2\u[1]\d\s+2\&. Note that this function is defined as inline function\&.
.PP
\fBsd_event_source_ref()\fR
may be used to increase by one the reference counter of the event source object specified as
\fIsource\fR\&.
.PP
\fBsd_event_source_unref()\fR,
\fBsd_bus_creds_unrefp()\fR
and
\fBsd_bus_creds_ref()\fR
execute no operation if the passed event source object is
\fBNULL\fR\&.
.PP
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
\fBsd_event_source_unref()\fR
with a prior call to
\fBsd_event_source_set_enabled()\fR
with
\fBSD_EVENT_OFF\fR\&.
.SH "RETURN VALUE"
.PP
\fBsd_event_source_unref()\fR
always returns
\fBNULL\fR\&.
\fBsd_event_source_ref()\fR
always returns the event source object passed in\&.
.SH "NOTES"
.PP
These APIs are implemented as a shared library, which can be compiled and linked to with the
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
file\&.
.SH "SEE ALSO"
.PP
\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)
.SH "NOTES"
.IP " 1." 4
Clean-up Variable Attribute
.RS 4
\%https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
.RE
|