sleep indefinitely
开发者_Python百科I was wondering if there is a statement which I can use to have a program sleep indefinitely (probably using sleep function??). (I am obviously doing this waiting for a signal that is going to be delivered at some time to this process and it will wake it up)
You want pause().
EDIT: The most likely circumstances under which you might want to use pause()
will actually cause a race condition, so prefer sigsuspend()
.
On Unix, see either pause
or sigsuspend
.
And on Windows use Sleep(INFINITE)
精彩评论