Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-10

fpNanoSleep vs Select()

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ales Katona

Hello, I'd like to ask why Sleep() function in unix world uses Select() instead of fpNanoSleep()? Is there a particular reason? After a somewhat riggid discussion on the channel yesterday I came up testing threading using sleep() and nanosleep(). The difference in speed is huge. I'm prepared to make a patch for Sleep() to use NanoSleep but I'd like to know if there are any reasons again such approach.

Thanks

Ales

Reply by email

Michael Van Canneyt
to Ales Katona
Ales Katona wrote 6 lines
Hello, I'd like to ask why Sleep() function in unix world uses Select() instead of fpNanoSleep()? Is there a particular reason? After a somewhat riggid discussion on the channel yesterday I came up testing threading using sleep() and nanosleep(). The difference in speed is huge. I'm prepared to make a patch for Sleep() to use NanoSleep but I'd like to know if there are any reasons again such approach.

There is no reason against this, except that I'm not sure fpNanoSleep() exists on all platforms. Select() does.

Michael.

Reply by email

Jonas Maebe
to Michael Van Canneyt
Michael Van Canneyt wrote
There is no reason against this, except that I'm not sure fpNanoSleep() exists on all platforms. Select() does.

It should exist on most *nixes:

The nanosleep() function conforms to IEEE Std 1003.1b-1993 (``POSIX. 1'').

Jonas

Reply by email