This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: exit() and lock()
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: "wyb" <wyb at topsec dot com dot cn>
- Cc: <ecos-discuss at sources dot redhat dot com>
- Date: 23 Apr 2004 13:52:02 +0100
- Subject: Re: [ECOS] exit() and lock()
- References: <019f01c4292c$5bb5d6c0$1a0fa8c0@codingman>
"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