I am debugging the following code:
signal(SIGALRM, testt); alarm(1); result = recvfrom( listening_socket, buf, maxlen, 0, &from, &fromlen ); printf("stoped\n");
As described in man 3 siginterrupt , the alarm should interrupt the system call, but in my case it is not. An alarm handler is called, but recvfrom not interrupted.
However, when a new signal handler is specified by the signal function (2), the system call is interrupted by default.
If I add siginterrupt(SIGALRM, 1); after setting the alarm handler, then recvfrom is interrupted as expected.
What am I missing? What is wrong with my code?
NOTES: sigaction signal with sigaction not what I'm looking for.
Alexandru
source share