public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] cyg_thread_delay() finished, but thread remains in "SLEEPING" state ?
@ 2006-12-19  3:23 wang cui
  0 siblings, 0 replies; only message in thread
From: wang cui @ 2006-12-19  3:23 UTC (permalink / raw)
  To: ecos-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312; format=flowed, Size: 1246 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-19  3:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-19  3:23 [ECOS] cyg_thread_delay() finished, but thread remains in "SLEEPING" state ? wang cui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).