linux-sysprog · intermediate · ~15 min
Deliver a signal synchronously with raise().
Install a handler for SIGUSR1 that sets a flag, then raise(SIGUSR1). Implement int raise_and_flag(void) returning 1 if the handler ran.
#include <signal.h>
int raise_and_flag(void) {
/* TODO: install handler, raise(SIGUSR1), return the flag */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.