core: handle sigaction on Windows
This commit is contained in:
@@ -27,6 +27,39 @@
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
#ifdef __WIN32__
|
||||
struct sigaction
|
||||
{
|
||||
void (*sa_handler)(int);
|
||||
int sa_flags;
|
||||
int sa_mask;
|
||||
};
|
||||
|
||||
int
|
||||
sigaction(int sig, struct sigaction* action, struct sigaction* old)
|
||||
{
|
||||
if (sig == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (old == nullptr)
|
||||
{
|
||||
if (signal(sig, SIG_DFL) == SIG_ERR)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (signal(sig, action->sa_handler) == SIG_ERR)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup fatalimpl
|
||||
|
||||
Reference in New Issue
Block a user