sleep是用SIGALRM信号来实现的,所以被唤醒是有可能的。
但nanosleep应该不会,man nanosleep有这一段
Compared to sleep(3) and usleep(3), nanosleep has the advantage of not affecting any signals, it is standardized by POSIX, it provides higher timing resolution, and it allows to continue a sleep that has been interrupted by a signal more easily.