[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sleep() isn't sleepy
- Date: Thu, 09 Feb 2006 08:34:00 +1100
- From: chrisj at rtems.org (Chris Johns)
- Subject: Sleep() isn't sleepy
Ralph Preston wrote:
> 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>
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
> 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.