This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Detect if scheduler locked?
- From: Gary Thomas <gthomas at ecoscentric dot com>
- To: Grant Edwards <grante at visi dot com>
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 22 Oct 2002 09:30:25 -0600
- Subject: Re: [ECOS] Detect if scheduler locked?
- References: <20021022102034.A19826@visi.com>
On Tue, 2002-10-22 at 09:20, 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?
>
You can use this (in KAPI):
/* Read the scheduler lock value. */
externC cyg_ucount32 cyg_scheduler_read_lock(void)
Of course, I'd question what you are doing anyway. 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.
--
------------------------------------------------------------
Gary Thomas |
eCosCentric, Ltd. |
+1 (970) 229-1963 | eCos & RedBoot experts
gthomas@ecoscentric.com |
http://www.ecoscentric.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