Configure SIGUSR1 with sigaction() instead of signal()
If signal() is used to set a signal handler, only the first signal received will use the handler; any later signals use the default behavior (making swaylock terminate immediately, without unlocking). Using sigaction() ensures that the handler will be used every time.
This commit is contained in:
parent
f692ee0075
commit
0569a47ef7
7
main.c
7
main.c
@ -1269,7 +1269,12 @@ int main(int argc, char **argv) {
|
|||||||
loop_add_fd(state.eventloop, get_comm_reply_fd(), POLLIN, comm_in, NULL);
|
loop_add_fd(state.eventloop, get_comm_reply_fd(), POLLIN, comm_in, NULL);
|
||||||
|
|
||||||
loop_add_fd(state.eventloop, sigusr_fds[0], POLLIN, term_in, NULL);
|
loop_add_fd(state.eventloop, sigusr_fds[0], POLLIN, term_in, NULL);
|
||||||
signal(SIGUSR1, do_sigusr);
|
|
||||||
|
struct sigaction sa;
|
||||||
|
sa.sa_handler = do_sigusr;
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sa.sa_flags = SA_RESTART;
|
||||||
|
sigaction(SIGUSR1, &sa, NULL);
|
||||||
|
|
||||||
state.run_display = true;
|
state.run_display = true;
|
||||||
while (state.run_display) {
|
while (state.run_display) {
|
||||||
|
Loading…
Reference in New Issue
Block a user