Language/C
Why use select() instead of sleep()?
적외선
2012. 4. 26. 10:29
출처 : http://stackoverflow.com/questions/3125645/why-use-select-instead-of-sleep
답변 :
Select allow for accurate sub second wait, and is more portable than sleep. There are other ways to wait, see this question.
답변 :
Well, sleep(3) may be implemented by using signals. It depends on the platform.
When you use select(2) and poll(2), you know that no signals will be involved, which is often very useful. For example, if you are using alarm(2), you should not use sleep(3) as well, because "mixing calls to alarm and sleep is a bad idea" (according to the man page.)
Also, select and poll give you millisecond granularity when sleeping, but sleep only has a granularity in terms of seconds.
[출처] Why use select() instead of sleep()?|작성자 어처구니