# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
char raised; /* !=0 if has been raised */
void* handler; /* instance to receive call */
char safely; /* if !=0 then manage signal safely, otherwise react when raised */
char raised; /* !=0 if has been raised */
void* handler; /* instance to receive call */
char safely; /* if !=0 then manage signal safely, otherwise react when raised */
/* Receiver to all signals
If unsafe, it calls directly the Nit receiver,
/* Receiver to all signals
If unsafe, it calls directly the Nit receiver,
# otherwise the receiver is invoked when the signal is raised, it may
# crash the Nit system but is unavoidable for unstoppable signals.
fun handle_signal(signal: Int, safely: Bool) import receive_signal `{
# otherwise the receiver is invoked when the signal is raised, it may
# crash the Nit system but is unavoidable for unstoppable signals.
fun handle_signal(signal: Int, safely: Bool) import receive_signal `{
nit_SignalHandler_receive_signal = SignalHandler_receive_signal;
}
`}
# Set to ignore the signal
fun ignore_signal(signal: Int) `{
nit_SignalHandler_receive_signal = SignalHandler_receive_signal;
}
`}
# Set to ignore the signal
fun ignore_signal(signal: Int) `{
act.sa_handler = SIG_IGN;
sigaction(signal, &act, NULL);
act.sa_handler = SIG_IGN;
sigaction(signal, &act, NULL);
act.sa_handler = SIG_DFL;
sigaction(signal, &act, NULL);
act.sa_handler = SIG_DFL;
sigaction(signal, &act, NULL);