How to avoid the interruption of sleep calls due to a signal in Linux?
问题 I'm using a real time signal in Linux to be notified of the arrival of new data in a serial port. Unfortunately this causes sleep calls to be interrupted when there is signal. Does anybody know of a way to avoid this behavior? I tried using a regular signal (SIGUSR1) but I keep getting the same behavior. 回答1: From the nanosleep manpage: nanosleep delays the execution of the program for at least the time specified in *req. The function can return earlier if a signal has been delivered to the