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: AW: Blocking restricted in DSRs


"Neundorf, Alexander" <Alexander.Neundorf@jenoptik.com> writes:

> ...
> > Threads can call blocking functions with the scheduler locked. The
> > lock is essentially a per-thread variable so when the thread is
> > resumed the lock is returned to its former value.
> 
> IOW cyg_scheduler_lock() ensures that the scheduler doesn't run as
> long as the thread which called cyg_scheduler_lock() doesn't call a
> synchronization function which calls itself the scheduler, right ?
>

Correct.

> But still I don't understand the code.  cyg_scheduler_lock() calls
> Cyg_Scheduler::lock() in sched.inl, which calls
> inc_sched_lock(). This I find in smp.hxx. I don't see any thread
> specific data there, so how can this act thread-specific ?

The next lock value is passed as an argument to unlock_inner() and is
therefore saved across the context switch on the stack and set when
then thread is rescheduled. That is why I said "essentially", since it
is not stored explicitly in the thread object.

-- 
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]