[SDL] Why not nanosleep()?

Christian Bauer cbauer at student.physik.uni-mainz.de
Mon Apr 3 05:44:38 PDT 2000


On Mon, 3 Apr 2000, Maxim Sobolev wrote:
> I'm wondering why the SDL library doesn't use POSIX conformant nanosleep()
> function in its SDL_Delay() routine. Currently select() used for this purpose,

I also wondered a while ago and tried to replace the select() with
nanosleep() and usleep(). The result: under Linux 2.2.x, the select()
timeout seems to have a far higher accuracy and resolution than *sleep(),
e.g. nanosleep(3ms) on my machine usually waits for about 20-30ms,
sometimes 14-16ms, while select() is relatively constant at ~3ms.


  / Coding on PowerPC and proud of it
\/ http://www.uni-mainz.de/~bauec002/

More information about the SDL mailing list