Timers SIGRTMIN is causing Socket Read to error on EINTR
never used timers before and currently I am experiencing the problem.
I have setup timers to trap on a SIGRTMIN. I have a blocking socket that does read_socket. whenever the timer expire, the read_socket will return with - and EINTR. after much searching I discover the issue comes from a Blocking socket implementation. I cannot change the socket to non-blocking as it will eat up the CPU. Is there a different way I can implement timers? or is there a way I can setup a blocking socket to prevent the return of EINTR? |
A better solution is continue to read socket when occurs some EINTR signal.
for example while(1) { ret = read(sockfd...); if ( ret < 0 && errno == EINTR ) continue; //do other logic } |
All times are GMT -5. The time now is 09:42 PM. |