| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sd_bus_slot_ref" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
<refentryinfo> |
| 8 |
<title>sd_bus_slot_ref</title> |
| 9 |
<productname>systemd</productname> |
| 10 |
</refentryinfo> |
| 11 |
|
| 12 |
<refmeta> |
| 13 |
<refentrytitle>sd_bus_slot_ref</refentrytitle> |
| 14 |
<manvolnum>3</manvolnum> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>sd_bus_slot_ref</refname> |
| 19 |
<refname>sd_bus_slot_unref</refname> |
| 20 |
<refname>sd_bus_slot_unrefp</refname> |
| 21 |
|
| 22 |
<refpurpose>Create and destroy references to a bus slot object</refpurpose> |
| 23 |
</refnamediv> |
| 24 |
|
| 25 |
<refsynopsisdiv> |
| 26 |
<funcsynopsis> |
| 27 |
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> |
| 28 |
|
| 29 |
<funcprototype> |
| 30 |
<funcdef>sd_bus_slot *<function>sd_bus_slot_ref</function></funcdef> |
| 31 |
<paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef> |
| 32 |
</funcprototype> |
| 33 |
|
| 34 |
<funcprototype> |
| 35 |
<funcdef>sd_bus_slot *<function>sd_bus_slot_unref</function></funcdef> |
| 36 |
<paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef> |
| 37 |
</funcprototype> |
| 38 |
|
| 39 |
<funcprototype> |
| 40 |
<funcdef>void <function>sd_bus_slot_unrefp</function></funcdef> |
| 41 |
<paramdef>sd_bus_slot **<parameter>slotp</parameter></paramdef> |
| 42 |
</funcprototype> |
| 43 |
</funcsynopsis> |
| 44 |
</refsynopsisdiv> |
| 45 |
|
| 46 |
<refsect1> |
| 47 |
<title>Description</title> |
| 48 |
|
| 49 |
<para><function>sd_bus_slot_ref()</function> increases the internal reference counter of |
| 50 |
<parameter>slot</parameter> by one.</para> |
| 51 |
|
| 52 |
<para><function>sd_bus_slot_unref()</function> decreases the internal reference counter of |
| 53 |
<parameter>slot</parameter> by one. Once the reference count has dropped to zero, slot object is |
| 54 |
destroyed and cannot be used anymore, so further calls to <function>sd_bus_slot_ref()</function> |
| 55 |
or <function>sd_bus_slot_unref()</function> are illegal.</para> |
| 56 |
|
| 57 |
<para><function>sd_bus_slot_unrefp()</function> is similar to |
| 58 |
<function>sd_bus_slot_unref()</function> but takes a pointer to a pointer to an |
| 59 |
<type>sd_bus_slot</type> object. This call is useful in conjunction with GCC's and LLVM's <ulink |
| 60 |
url="https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html">Clean-up Variable |
| 61 |
Attribute</ulink>. See |
| 62 |
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
| 63 |
for an example how to use the cleanup attribute.</para> |
| 64 |
|
| 65 |
<para><function>sd_bus_slot_ref()</function> and <function>sd_bus_slot_unref()</function> |
| 66 |
execute no operation if the passed in bus object address is |
| 67 |
<constant>NULL</constant>. <function>sd_bus_slot_unrefp()</function> will first dereference |
| 68 |
its argument, which must not be <constant>NULL</constant>, and will execute no operation if |
| 69 |
<emphasis>that</emphasis> is <constant>NULL</constant>.</para> |
| 70 |
</refsect1> |
| 71 |
|
| 72 |
<refsect1> |
| 73 |
<title>Return Value</title> |
| 74 |
|
| 75 |
<para><function>sd_bus_slot_ref()</function> always returns the argument.</para> |
| 76 |
|
| 77 |
<para><function>sd_bus_slot_unref()</function> always returns <constant>NULL</constant>.</para> |
| 78 |
</refsect1> |
| 79 |
|
| 80 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 81 |
|
| 82 |
<refsect1> |
| 83 |
<title>History</title> |
| 84 |
<para><function>sd_bus_slot_ref()</function>, |
| 85 |
<function>sd_bus_slot_unref()</function>, and |
| 86 |
<function>sd_bus_slot_unrefp()</function> were added in version 240.</para> |
| 87 |
</refsect1> |
| 88 |
|
| 89 |
<refsect1> |
| 90 |
<title>See Also</title> |
| 91 |
|
| 92 |
<para><simplelist type="inline"> |
| 93 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 94 |
<member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 95 |
<member><citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 96 |
<member><citerefentry><refentrytitle>sd_bus_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 97 |
<member><citerefentry><refentrytitle>sd_bus_call_method_async</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 98 |
</simplelist></para> |
| 99 |
</refsect1> |
| 100 |
|
| 101 |
</refentry> |