Question about threading implementation

Jonathon McKitrick jcm at FreeBSD-uk.eu.org
Mon Mar 7 19:16:23 PST 2005


On Tue, Mar 08, 2005 at 10:49:07AM +1000, Andrew Hacking wrote:
: On Mon, 2005-03-07 at 22:24, Jonathon McKitrick wrote:
: 
: > On Mon, Mar 07, 2005 at 11:43:53AM +1000, Andrew Hacking wrote:
: > : Calling sleep() in a multi-threaded program is probably not safe since
: > : it suspends the process, not just the thread.
: > : You should always call nanosleep() in multi-threaded apps.
: > 
: > Are you sure nanosleep() doesn't suspend the process?
: > 
: 
: 
: As sure as I can be. ;-)
: 
: I remember experiencing a number of problems with sleep() on at least
: one or more unix variants when using threads.
: However I have used nanosleep() sucessfully on FreeBSD, Solaris, Linux,
: AIX and HP-UX.
: 
: The FreeBSD implementation of sleep() is based on nanosleep() [according
: to the man page] so I was probably wrong to say don't use sleep() in

Okay, I believe you.  :-)  But the man page talks only about processes and
does not mention threads.


Jonathon McKitrick
--
My other computer is your Windows box.





More information about the Users mailing list