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?


On Tue, Oct 22, 2002 at 09:30:25AM -0600, Gary Thomas wrote:

> > How does application code determine if the scheduler is locked?
> 
> You can use this (in KAPI):
> 	/* Read the scheduler lock value. */
> 	externC cyg_ucount32 cyg_scheduler_read_lock(void)

Thanks.  I didn't notice it in the docs -- should've scanned
the sources quickly.

> Of course, I'd question what you are doing anyway.

I should hope so.

It's a flash-erase routine that's waiting for the flash to
return a ready status.  I originally wrote it so that it calls
cyg_thread_delay() in a loop while checking flash status. After
100 times through the loop (1 second), it gives up and declares
failure.

Now I've got a customer who is calling this routine with the
scheduler locked (in order to prevent other tasks from
attempting to read the flash while it's busy, I presume).

> If this [thread] needs to wait for some period of time, I'd
> argue that if it's a long enough time (10's of milliseconds by
> default) to use 'cyg_thread_delay()', then you probably
> shouldn't be doing it with the scheduler locked anyway - since
> nothing else can run.

I agree and I've advised my customer of the possible
implications of keeping the scheduler locked for 1000ms.
Nonetheless, it's my job to make sure my customers can shoot
themselves in the feet in a timely and efficient manner.  :)

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


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