This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Re: exit() and lock()


"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


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