1 module pulse.mainloopsignal;
2 
3 import pulse.mainloopapi;
4 
5 extern (C):
6 
7 /***
8   This file is part of PulseAudio.
9 
10   Copyright 2004-2008 Lennart Poettering
11   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
12 
13   PulseAudio is free software; you can redistribute it and/or modify
14   it under the terms of the GNU Lesser General Public License as published
15   by the Free Software Foundation; either version 2.1 of the License,
16   or (at your option) any later version.
17 
18   PulseAudio is distributed in the hope that it will be useful, but
19   WITHOUT ANY WARRANTY; without even the implied warranty of
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21   General Public License for more details.
22 
23   You should have received a copy of the GNU Lesser General Public License
24   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
25 ***/
26 
27 /** \file
28  * UNIX signal support for main loops. In contrast to other
29  * main loop event sources such as timer and IO events, UNIX signal
30  * support requires modification of the global process
31  * environment. Due to this the generic main loop abstraction layer as
32  * defined in \ref mainloop-api.h doesn't have direct support for UNIX
33  * signals. However, you may hook signal support into an abstract main loop via the routines defined herein.
34  */
35 
36 /** An opaque UNIX signal event source object */
37 struct pa_signal_event;
38 
39 /** Callback prototype for signal events */
40 alias pa_signal_cb_t = void function (pa_mainloop_api* api, pa_signal_event* e, int sig, void* userdata);
41 
42 /** Destroy callback prototype for signal events */
43 alias pa_signal_destroy_cb_t = void function (pa_mainloop_api* api, pa_signal_event* e, void* userdata);
44 
45 /** Initialize the UNIX signal subsystem and bind it to the specified main loop */
46 int pa_signal_init (pa_mainloop_api* api);
47 
48 /** Cleanup the signal subsystem */
49 void pa_signal_done ();
50 
51 /** Create a new UNIX signal event source object */
52 pa_signal_event* pa_signal_new (int sig, pa_signal_cb_t callback, void* userdata);
53 
54 /** Free a UNIX signal event source object */
55 void pa_signal_free (pa_signal_event* e);
56 
57 /** Set a function that is called when the signal event source is destroyed. Use this to free the userdata argument if required */
58 void pa_signal_set_destroy (pa_signal_event* e, pa_signal_destroy_cb_t callback);
59