SIGINT(ctrl+c) doesn't interrupt accept call
c, signals, sockets, unix
Solution
Your OS is using `SA_RESTART` semantics by default when using `signal()`. You should be able to confirm this in the man page. Since you don't want this to happen, use `sigaction()` to set the handler and omit the `SA_RESTART` flag.
Problem
In infinite loop, i am accepting new connections, but i need choice to stop that server, so i want use ctrl+c (SIGINT). When i press it, it calls my signal handler, but it doesn't interrupt accept call, so the check if interrupt is true isn't evaluated (when no client's connecting, so accept is blocking for long while). ``` sig_atomic_t interrupt; . . . signal(SIGINT, sigintHandler); . . . while(!interrupt) { server.accept(); } . . . void sigintHandler(int param) { interrupt = 1; } ```