1/*
2    Title:  sighandler.h
3
4    Copyright (c) 2000-7, 2016 David C.J. Matthews
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License version 2.1 as published by the Free Software Foundation.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19*/
20
21#ifndef _SIGHANDLER_H
22#define _SIGHANDLER_H 1
23
24class TaskData;
25
26extern void markSignalInuse(int sig);
27
28#if (defined(_WIN32) && ! defined(__CYGWIN__))
29extern void RequestConsoleInterrupt(void);
30#else
31
32#ifdef HAVE_SIGNAL_H
33#include <signal.h>
34#endif
35
36extern void init_asyncmask(sigset_t *mask);
37
38#define SIG_HANDLER_ARGS(_sig,_contxt)    int _sig, siginfo_t *, void *_contxt
39
40typedef void (*signal_handler_type)(SIG_HANDLER_ARGS(s, c));
41
42extern bool setSignalHandler(int sig, signal_handler_type func);
43// Set up per-thread signal data: basically signal stack.
44extern void initThreadSignals(TaskData *taskData);
45
46#endif /* ! _WIN32 */
47
48extern unsigned receivedSignalCount; // Incremented each time we get a signal
49
50extern struct _entrypts sigHandlerEPT[];
51
52#endif
53