Sleep() isn't sleepy

Chris Johns chrisj at
Wed Feb 8 21:34:00 UTC 2006

Ralph Preston wrote:
> Hello,
> Yesterday I was testing some code and threw in a sleep() statement to aid
> debugging. It didn't work, and unfortunately, it seems to be more difficult
> that I imagined it would be.  The code compiles and runs but doesn't sleep,
> I haven't stepped through the code yet to see exactly what's happening to
> the sleep() since I thought it's probably a #define, or something simple
> that I've missed.

The sleep call is code in the POSIX part of the score:


It calls nanosleep.

> I know I enabled the posix api with --enable-posix.
> I'm using the hello_world_c makefile as a starting point and added "timer"
> and "clock" to the managers.
> To the code I added:
> #include <time.h>
> Is there anything else I need to do to get sleep() to work?

Did you check what sleep returns ? A signal can wake a sleep call and 
sleep returns the remaining seconds.


More information about the users mailing list