chiark / gitweb /
man: drop unused <authorgroup> tags from man sources
[elogind.git] / man / sd_event_source_set_enabled.xml
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 <!--
6   SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="sd_event_source_set_enabled" xmlns:xi="http://www.w3.org/2001/XInclude">
10
11   <refentryinfo>
12     <title>sd_event_source_set_enabled</title>
13     <productname>elogind</productname>
14   </refentryinfo>
15
16   <refmeta>
17     <refentrytitle>sd_event_source_set_enabled</refentrytitle>
18     <manvolnum>3</manvolnum>
19   </refmeta>
20
21   <refnamediv>
22     <refname>sd_event_source_set_enabled</refname>
23     <refname>sd_event_source_get_enabled</refname>
24     <refname>SD_EVENT_ON</refname>
25     <refname>SD_EVENT_OFF</refname>
26     <refname>SD_EVENT_ONESHOT</refname>
27
28     <refpurpose>Enable or disable event sources</refpurpose>
29   </refnamediv>
30
31   <refsynopsisdiv>
32     <funcsynopsis>
33       <funcsynopsisinfo>#include &lt;elogind/sd-event.h&gt;</funcsynopsisinfo>
34
35       <funcsynopsisinfo><token>enum</token> {
36         <constant>SD_EVENT_OFF</constant> = 0,
37         <constant>SD_EVENT_ON</constant> = 1,
38         <constant>SD_EVENT_ONESHOT</constant> = -1,
39 };</funcsynopsisinfo>
40
41       <funcprototype>
42         <funcdef>int <function>sd_event_source_set_enabled</function></funcdef>
43         <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
44         <paramdef>int <parameter>enabled</parameter></paramdef>
45       </funcprototype>
46
47       <funcprototype>
48         <funcdef>int <function>sd_event_source_get_enabled</function></funcdef>
49         <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
50         <paramdef>int *<parameter>enabled</parameter></paramdef>
51       </funcprototype>
52
53     </funcsynopsis>
54   </refsynopsisdiv>
55
56   <refsect1>
57     <title>Description</title>
58
59     <para><function>sd_event_source_set_enabled()</function> may be
60     used to enable or disable the event source object specified as
61     <parameter>source</parameter>. The <parameter>enabled</parameter>
62     parameter takes one of <constant>SD_EVENT_ON</constant> (to
63     enable), <constant>SD_EVENT_OFF</constant> (to disable) or
64     <constant>SD_EVENT_ONESHOT</constant>. If invoked with
65     <constant>SD_EVENT_ONESHOT</constant> the event source will be
66     enabled but automatically reset to
67     <constant>SD_EVENT_OFF</constant> after the event source was
68     dispatched once.</para>
69
70     <para>Event sources that are disabled will not result in event
71     loop wakeups and will not be dispatched, until they are enabled
72     again.</para>
73
74     <para><function>sd_event_source_get_enabled()</function> may be
75     used to query whether the event source object
76     <parameter>source</parameter> is currently enabled or not. It
77     returns the enablement state in
78     <parameter>enabled</parameter>.</para>
79
80     <para>Event source objects are enabled when they are first created
81     with calls such as
82     <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
83     <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>. However,
84     depending on the event source type they are enabled continuously
85     (<constant>SD_EVENT_ON</constant>) or only for a single invocation
86     of the event source handler
87     (<constant>SD_EVENT_ONESHOT</constant>). For details see the
88     respective manual pages.</para>
89
90     <para>As event source objects stay active and may be dispatched as
91     long as there is at least one reference to them, in many cases it
92     is a good idea to combine a call to
93     <citerefentry><refentrytitle>sd_event_source_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
94     with a prior call to
95     <function>sd_event_source_set_enabled()</function> with
96     <constant>SD_EVENT_OFF</constant>, to ensure the event source is
97     not dispatched again until all other remaining references are dropped.</para>
98   </refsect1>
99
100   <refsect1>
101     <title>Return Value</title>
102
103     <para>On success, <function>sd_event_source_set_enabled()</function> and
104     <function>sd_event_source_get_enabled()</function> return a
105     non-negative integer. On failure, they return a negative
106     errno-style error code.</para>
107   </refsect1>
108
109   <refsect1>
110     <title>Errors</title>
111
112     <para>Returned errors may indicate the following problems:</para>
113
114     <variablelist>
115       <varlistentry>
116         <term><constant>-EINVAL</constant></term>
117
118         <listitem><para><parameter>source</parameter> is not a valid
119         pointer to an <structname>sd_event_source</structname>
120         object.</para></listitem>
121       </varlistentry>
122
123       <varlistentry>
124         <term><constant>-ENOMEM</constant></term>
125
126         <listitem><para>Not enough memory.</para></listitem>
127       </varlistentry>
128
129       <varlistentry>
130         <term><constant>-ECHILD</constant></term>
131
132         <listitem><para>The event loop has been created in a different process.</para></listitem>
133
134       </varlistentry>
135
136     </variablelist>
137   </refsect1>
138
139   <xi:include href="libelogind-pkgconfig.xml" />
140
141   <refsect1>
142     <title>See Also</title>
143
144     <para>
145       <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
146       <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
147       <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
148       <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
149       <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
150       <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
151       <citerefentry><refentrytitle>sd_event_source_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
152     </para>
153   </refsect1>
154
155 </refentry>