Commit f51cc531 authored by Steffen Michels's avatar Steffen Michels

add function to ignore a signal

parent dba2e2ed
Pipeline #30585 passed with stage
in 3 minutes and 4 seconds
......@@ -41,3 +41,8 @@ void signal_poll(long handler, long *ok, long *state, long *handlerr)
*ok = 0;
}
}
int signal_ignore(long signum)
{
return signal(signum, SIG_IGN) == SIG_ERR;
}
......@@ -6,7 +6,7 @@ import System._Signal
:: SigHandler
/*
/**
* Install a signal handler
*
* @param Signal type
......@@ -16,7 +16,7 @@ import System._Signal
*/
signalInstall :: !Int !*env -> *(MaybeOSError *SigHandler, !*env)
/*
/**
* Poll a signal, this resets the state
*
* @param Signal handler
......@@ -26,3 +26,11 @@ signalInstall :: !Int !*env -> *(MaybeOSError *SigHandler, !*env)
* @return New world
*/
signalPoll :: !*SigHandler !*env -> *(!MaybeErrorString Bool, !*SigHandler, !*env)
/**
* Ignore a signal
*
* @param Signal type
* @param World
*/
signalIgnore :: !Int !*env -> (!MaybeOSError (), !*env)
......@@ -30,3 +30,13 @@ where
signalPoll_ _ _= code {
ccall signal_poll "I:VIII:A"
}
signalIgnore :: !Int !*env -> (!MaybeOSError (), !*env)
signalIgnore signum w
# (error, w) = signalIgnore` signum w
= if error (getLastOSError w) (Ok (), w)
where
signalIgnore` :: !Int !*env -> (!Bool, !*env)
signalIgnore` signum w = code {
ccall signal_ignore "I:I:A"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment