What's the problem of pause() at all?
问题 According to this paragraph ,the following has problem: /* usr_interrupt is set by the signal handler. */ if (!usr_interrupt) pause (); /* Do work once the signal arrives. */ ... And should use sigsuspend instead. But I still don't see what the problem is with pause and how sigsuspend solves it, anyone can explain in more details? 回答1: Let's examine what happens when a signal arrives after you've checked usr_interrupt but before you call pause : main thread signal handler ----------- --------