1 /* 2 * Copyright 2007, Vasilis Kaoutsis, kaoutsis@sch.gr 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <signal.h> 8 9 10 int 11 sighold(int signal) 12 { 13 // make an empty set 14 // and add the signal 15 sigset_t tempSignalSet; 16 sigemptyset(&tempSignalSet); 17 if (sigaddset(&tempSignalSet, signal) == -1) 18 return -1; 19 20 // add the signal to the calling process' signal mask 21 return sigprocmask(SIG_BLOCK, &tempSignalSet, NULL); 22 } 23