public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] exit() and lock()
@ 2004-04-23 13:17 wyb
  2004-04-23 14:13 ` Nick Garnett
  0 siblings, 1 reply; 2+ messages in thread
From: wyb @ 2004-04-23 13:17 UTC (permalink / raw)
  To: ecos-discuss

I'm reading the ECOS source code, and confused by Cyg_Thread::exit() calling lock() on entry, but not calling unlock() before return (Althrough it never return)

Can anybody help me? thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] exit() and lock()
  2004-04-23 13:17 [ECOS] exit() and lock() wyb
@ 2004-04-23 14:13 ` Nick Garnett
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Garnett @ 2004-04-23 14:13 UTC (permalink / raw)
  To: wyb; +Cc: ecos-discuss

"wyb" <wyb@topsec.com.cn> writes:

> I'm reading the ECOS source code, and confused by Cyg_Thread::exit()
> calling lock() on entry, but not calling unlock() before return
> (Althrough it never return)
> 
> Can anybody help me? thanks

The last thing it does is call Cyg_Scheduler::reschedule(). This
causes the current thread to lose control of the CPU without
decrementing the scheduler lock. 

The scheduler lock is effectively a per-thread value, so when the
context switches to another thread, the lock will be set to that
thread's lock value. It simply doesn't matter that the exited thread
has a non-zero lock value, it will never be rescheduled.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


-- 
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] 2+ messages in thread

end of thread, other threads:[~2004-04-23 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 13:17 [ECOS] exit() and lock() wyb
2004-04-23 14:13 ` Nick Garnett

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).