X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=signal.h;h=e5532ded5a9378619f7951708b49c5b38bf52d18;hp=7be960efa56c983a1f9fe0e2f0b6fb9d4e4eeddb;hb=HEAD;hpb=6668ac4a8c7f2a92efb9e6d405d954beff77d230 diff --git a/signal.h b/signal.h index 7be960ef..d9e98e78 100644 --- a/signal.h +++ b/signal.h @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2007-2010 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2007 Andre Noll , see file COPYING. */ /** \file signal.h exported symbols from signal.c */ @@ -12,15 +8,36 @@ struct signal_task { /** The signal pipe. */ int fd; - /** The number of the most recent signal. */ - int signum; /** The associated task structure. */ - struct task task; + struct task *task; }; -int para_signal_init(void); +/** + * Monitor the signal fd for reading. + * + * \param s The scheduler instance. + * \param context Signal task pointer. + * + * This convenience helper is called from several programs which need to handle + * signals, including para_server and para_audiod. These programs set up a + * signal pipe and a signal task structure, and use this function to tell the + * scheduler to monitor the read end of the pipe. + * + * Although the second parameter must be in fact a pointer to a signal_task + * structure, the parameter is specified as void * here to match the signature + * declared in struct \ref task_info. + */ +_static_inline_ void signal_pre_monitor(struct sched *s, void *context) +{ + struct signal_task *st = context; + sched_monitor_readfd(st->fd, s); +} + +struct signal_task *signal_init_or_die(void); void para_sigaction(int sig, void (*handler)(int)); void para_install_sighandler(int); int para_reap_child(pid_t *pid); int para_next_signal(void); -void para_signal_shutdown(void); +void signal_shutdown(struct signal_task *st); +void para_block_signal(int sig); +void para_unblock_signal(int sig);