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: suspend/resume nesting


> How would A release the scheduler lock while being
> suspended?
> > <iii> A invokes suspend for itself [sched_lock goes 1->2->1  in this call]
> > [sched_lock = 1]
> > <iv> A releases schedular_lock
> > [sched_lock goes to 0 resulting in call to unlock_inner causing A to be
taken
> > off and B to be brought in]

* you can continue running till you are taken off the processor.*
it is not that -- that the minute your state is marked as SUSPENDED you can't
run.
the unlock() call is made by the thread that is marked as SUSPENDED. Isn't it
executing as a part of this thread's execution?

*if sched_lock was 0 when entering*  "Cyg_Thread::suspend"
----------------------
 // Set the state
 state |= SUSPENDED;

 // Unlock the scheduler and maybe switch threads
 Cyg_Scheduler::unlock();
-----------------------
then the unlock call will result in call to unlock_inner and will cause this
thread to be taken off processor.
next time when this thread is brought in, it will be returning to suspend
function after the unlock call.

hope it clears the things for you.
regards
sandeep




-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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