Convert audioc to lopsub.
[paraslash.git] / signal.h
1 /*
2  * Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>
3  *
4  * Licensed under the GPL v2. For licencing details see COPYING.
5  */
6
7 /** \file signal.h exported symbols from signal.c */
8
9 /**
10  * Task for signal handling.
11  */
12 struct signal_task {
13         /** The signal pipe. */
14         int fd;
15         /** The associated task structure. */
16         struct task *task;
17 };
18
19 /**
20  * A generic pre-select method for signal tasks.
21  *
22  * \param s Passed to para_fd_set().
23  * \param context Signal task pointer.
24  *
25  * This convenience helper is called from several programs which need to handle
26  * signals, including para_server and para_audiod. These programs define a
27  * signal task structure and set its ->pre_select method to this function which
28  * adds the file descriptor of the signal task to the set of descriptors to be
29  * watched in the next select() call.
30  *
31  * Although the second parameter must be in fact a pointer to a signal_task
32  * structure, the parameter is specified as void * here to match the
33  * ->pre_select method of struct task.
34  */
35 _static_inline_ void signal_pre_select(struct sched *s, void *context)
36 {
37         struct signal_task *st = context;
38         para_fd_set(st->fd, &s->rfds, &s->max_fileno);
39 }
40
41 struct signal_task *signal_init_or_die(void);
42 void para_sigaction(int sig, void (*handler)(int));
43 void para_install_sighandler(int);
44 int para_reap_child(pid_t *pid);
45 int para_next_signal(fd_set *rfds);
46 void signal_shutdown(struct signal_task *st);
47 void para_block_signal(int sig);
48 void para_unblock_signal(int sig);