nanosleep blocks inifinity (internal rtems deathlock?) even CPU is in idle Task

Joel Sherrill joel.sherrill at
Thu Nov 15 16:32:46 UTC 2012

On 11/15/2012 7:52 AM, Sebastian Huber wrote:
> On 11/15/2012 01:26 PM, Matthias Goldhoorn wrote:
>> On 15.11.2012 11:52, Sebastian Huber wrote:
>>> On 11/15/2012 10:44 AM, Matthias Goldhoorn wrote:
>>>> Hello Again,
>>>> new Problem i got the debugger working (will port it later to the wiki, needed
>>>> adaptations for the compiler and mentioned scripts).
>>>> It seems there is an bugg inside of rtems. My Code calls nanosleep and never
>>>> returnes from there.
>>>> My main-cread is idling, so there is no higher priority process running. I
>>>> wonder why my thread which has called nanosleep never returns...
>>>> Any suggestions?
>>> Do you have a clock driver configured, e.g.
>>> #define CONFIGURE_INIT
>>> [...]
>>> #include <rtems/confdefs.h>
>> Yeah it's both defined.
>> The nanosleep sometimes (mostly) works.
>> Only if some interrupts during the sleep i got this non-awaking behavior it
>> seems strange.
>> Maybe broke my memory or stack anywhere. Could you tell me where the scheduler
>> of rtems is located to that i can define a breakpoint into him and check why my
>> thread is not waked up.
>> I searching the timer interrupt function that really does the thread management.
> Which BSP do you use and which RTEMS version?
> You can set a break point to rtems_clock_tick() to see if the system timer
> works.  It should update the timer of the nanosleep() task and wake it up
> eventually.
In addition, can we see some code? If you have done something minor 
wrong, we
will likely see it.

Does this code run on any other BSP/simulator?

Also there is a variable _Watchdog_Ticks_since_boot which should be 
incrementing on
each clock tick. If it isn't incrementing, then interrupts are not 

Ultimately _Thread_Delay_ended() is invoked to unblock the task from the 

Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill at        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985

More information about the users mailing list