[ECOS] exit() and lock()

Nick Garnett nickg@ecoscentric.com
Fri Apr 23 14:13:00 GMT 2004

"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

More information about the Ecos-discuss mailing list