X Tutup
Skip to content

Commit aa7585f

Browse files
committed
sd-event: add sd_event_source_disable_unrefp() too
I do not have any immediate use for it, but let's add it for completeness.
1 parent afd15bb commit aa7585f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

man/rules/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ manpages = [
446446
['sd_event_source_unref',
447447
'3',
448448
['sd_event_source_disable_unref',
449+
'sd_event_source_disable_unrefp',
449450
'sd_event_source_ref',
450451
'sd_event_source_unrefp'],
451452
''],

man/sd_event_source_unref.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<refname>sd_event_source_unrefp</refname>
2121
<refname>sd_event_source_ref</refname>
2222
<refname>sd_event_source_disable_unref</refname>
23+
<refname>sd_event_source_disable_unrefp</refname>
2324

2425
<refpurpose>Increase or decrease event source reference counters</refpurpose>
2526
</refnamediv>
@@ -47,6 +48,11 @@
4748
<funcdef>sd_event_source* <function>sd_event_source_disable_unref</function></funcdef>
4849
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
4950
</funcprototype>
51+
52+
<funcprototype>
53+
<funcdef>void <function>sd_event_source_disable_unrefp</function></funcdef>
54+
<paramdef>sd_event_source **<parameter>source</parameter></paramdef>
55+
</funcprototype>
5056
</funcsynopsis>
5157
</refsynopsisdiv>
5258

@@ -94,6 +100,12 @@
94100
<function>sd_event_source_unref()</function>. This ensures that the source is disabled before the local
95101
reference to it is lost. The <parameter>source</parameter> parameter is allowed to be
96102
<constant>NULL</constant>.</para>
103+
104+
<para><function>sd_event_source_disable_unrefp()</function> is similar to
105+
<function>sd_event_source_unrefp()</function>, but in addition disables the source first. This call is
106+
useful in conjunction with GCC's and LLVM's
107+
<ulink url="https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html">Clean-up Variable
108+
Attribute</ulink>. Note that this function is defined as inline function.</para>
97109
</refsect1>
98110

99111
<refsect1>

src/systemd/sd-event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ int sd_event_source_set_floating(sd_event_source *s, int b);
150150
/* Define helpers so that __attribute__((cleanup(sd_event_unrefp))) and similar may be used. */
151151
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_event, sd_event_unref);
152152
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_event_source, sd_event_source_unref);
153+
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_event_source, sd_event_source_disable_unref);
153154

154155
_SD_END_DECLARATIONS;
155156

0 commit comments

Comments
 (0)
X Tutup