This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cyg_thread_delay() finished, but thread remains in "SLEEPING" state ?


I call cyg_thread_delay() in my I2C driver at very beginning in the context of main(), I think scheduler should switch to another thread(at least "idle" thread) and switch back to main() when delay time expired.
But I found after calling cyg_thread_delay(), main() thread remains in "SLEEPING" state.
When later other threads are resumed, if context switch happens again, main() thread will never be switched back (because it is in "SLEEPING").


So I debugged it, I found when I call cyg_thread_delay(), main() is NOT switched. So the cyg_thread_delay() returns immediately, and main() is not switched back through normal wake() function, and so the thread's state is not changed to "RUNNING".

Why doesn't the main() be switched to the "idle" thread?

I think when I call cyg_thread_delay() in driver, the scheduler is locked in some early caller.
So is there a limitation that: the cyg_thread_delay() should not be called when the scheduler is locked?


_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/



-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]