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: Detect if scheduler locked?


In packages/kernel/current/src/common/kapi.cxx:

/* Read the scheduler lock value. */
externC cyg_ucount32 cyg_scheduler_read_lock(void)
{
    cyg_ucount32 slock = Cyg_Scheduler::get_sched_lock();
    return slock;
}

You will have to be careful how you use it though. There are obvious
race conditions to be avoided.

     Andrew


On Tue, Oct 22, 2002 at 10:20:35AM -0500, Grant Edwards wrote:
> 
> I'm trying to make a function work properly if called when the
> scheduler is locked.  
> 
> In order to do this right, the function needs to know whether
> it can call cyg_thread_delay().  If the scheduler is locked, it
> will have to use some sort of delay loop rather than call
> cyg_thread_delay().  It would be trivial to get it would work
> right if cyg_current_time() continued to increment while the
> scheduler was locked, but it doesn't (probaby requires the
> timer DSR to run).
> 
> How does application code determine if the scheduler is locked?
> 
> -- 
> Grant Edwards
> grante@visi.com
> 
> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> 

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