]>
Commit | Line | Data |
---|---|---|
dc83f27a LP |
1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
4 | ||
5 | <!-- | |
572eb058 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
7 | ||
dc83f27a LP |
8 | This file is part of systemd. |
9 | ||
10 | Copyright 2015 Lennart Poettering | |
dc83f27a LP |
11 | --> |
12 | ||
13 | <refentry id="sd_event_source_unref" xmlns:xi="http://www.w3.org/2001/XInclude"> | |
14 | ||
15 | <refentryinfo> | |
16 | <title>sd_event_source_unref</title> | |
17 | <productname>systemd</productname> | |
18 | ||
19 | <authorgroup> | |
20 | <author> | |
21 | <contrib>Developer</contrib> | |
22 | <firstname>Lennart</firstname> | |
23 | <surname>Poettering</surname> | |
24 | <email>lennart@poettering.net</email> | |
25 | </author> | |
26 | </authorgroup> | |
27 | </refentryinfo> | |
28 | ||
29 | <refmeta> | |
30 | <refentrytitle>sd_event_source_unref</refentrytitle> | |
31 | <manvolnum>3</manvolnum> | |
32 | </refmeta> | |
33 | ||
34 | <refnamediv> | |
35 | <refname>sd_event_source_unref</refname> | |
4afd3348 | 36 | <refname>sd_event_source_unrefp</refname> |
dc83f27a LP |
37 | <refname>sd_event_source_ref</refname> |
38 | ||
39 | <refpurpose>Increase or decrease event source reference counters</refpurpose> | |
40 | </refnamediv> | |
41 | ||
42 | <refsynopsisdiv> | |
43 | <funcsynopsis> | |
44 | <funcsynopsisinfo>#include <systemd/sd-event.h></funcsynopsisinfo> | |
45 | ||
46 | <funcprototype> | |
47 | <funcdef>sd_event_source* <function>sd_event_source_unref</function></funcdef> | |
48 | <paramdef>sd_event_source *<parameter>source</parameter></paramdef> | |
49 | </funcprototype> | |
50 | ||
4afd3348 LP |
51 | <funcprototype> |
52 | <funcdef>void <function>sd_event_source_unrefp</function></funcdef> | |
53 | <paramdef>sd_event_source **<parameter>source</parameter></paramdef> | |
54 | </funcprototype> | |
55 | ||
dc83f27a LP |
56 | <funcprototype> |
57 | <funcdef>sd_event_source* <function>sd_event_source_ref</function></funcdef> | |
58 | <paramdef>sd_event_source *<parameter>source</parameter></paramdef> | |
59 | </funcprototype> | |
60 | ||
61 | </funcsynopsis> | |
62 | </refsynopsisdiv> | |
63 | ||
64 | <refsect1> | |
65 | <title>Description</title> | |
66 | ||
67 | <para><function>sd_event_source_unref()</function> may be used to | |
68 | decrement by one the reference counter of the event source object | |
69 | specified as <parameter>source</parameter>. The reference counter | |
70 | is initially set to one, when the event source is created with calls | |
71 | such as | |
72 | <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
73 | or | |
74 | <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>. When | |
75 | the reference counter reaches zero it is removed from its event loop | |
76 | object and destroyed.</para> | |
77 | ||
4afd3348 LP |
78 | <para><function>sd_event_source_unrefp()</function> is similar to |
79 | <function>sd_event_source_unref()</function> but takes a pointer to a | |
80 | pointer to an <type>sd_event_source</type> object. This call is useful in | |
81 | conjunction with GCC's and LLVM's <ulink | |
82 | url="https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html">Clean-up | |
83 | Variable Attribute</ulink>. Note that this function is defined as | |
84 | inline function.</para> | |
85 | ||
dc83f27a LP |
86 | <para><function>sd_event_source_ref()</function> may be used |
87 | to increase by one the reference counter of the event source object | |
88 | specified as <parameter>source</parameter>.</para> | |
89 | ||
4afd3348 LP |
90 | <para><function>sd_event_source_unref()</function>, |
91 | <function>sd_bus_creds_unrefp()</function> and | |
92 | <function>sd_bus_creds_ref()</function> execute no operation if | |
93 | the passed event source object is | |
94 | <constant>NULL</constant>.</para> | |
dc83f27a LP |
95 | |
96 | <para>Note that event source objects stay alive and may be | |
97 | dispatched as long as they have a reference counter greater than | |
98 | zero. In order to drop a reference of an event source and make | |
99 | sure the associated event source handler function is not called | |
100 | anymore it is recommended to combine a call of | |
101 | <function>sd_event_source_unref()</function> with a prior call to | |
102 | <function>sd_event_source_set_enabled()</function> with | |
103 | <constant>SD_EVENT_OFF</constant>.</para> | |
104 | </refsect1> | |
105 | ||
106 | <refsect1> | |
107 | <title>Return Value</title> | |
108 | ||
109 | <para><function>sd_event_source_unref()</function> always returns | |
110 | <constant>NULL</constant>. | |
111 | <function>sd_event_source_ref()</function> always returns the | |
112 | event source object passed in.</para> | |
113 | </refsect1> | |
114 | ||
115 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
116 | ||
117 | <refsect1> | |
118 | <title>See Also</title> | |
119 | ||
120 | <para> | |
121 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
122 | <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
123 | <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
124 | <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
125 | <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
126 | <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
127 | <citerefentry><refentrytitle>sd_event_source_set_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
128 | </para> | |
129 | </refsect1> | |
130 | ||
131 | </refentry> |