The sigwait function blocks until a signal in the specified set is received.
What if more than one of those signals received?
What if several threads are calling sigwait for the same signal(s)?
computation_state_t state; sigset_t set; main( ) { pthread_t thread; sigemptyset(&set); sigaddset(&set, SIGINT); sigprocmask(SIG_BLOCK, &set, 0); pthread_create(&thread, 0, monitor, 0); long_running_procedure( ); } void *monitor( ) { int sig; while (1) { sigwait(&set, &sig); display(&state); } return(0); }