This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: How to know if the scheduler is already running
- From: Ross Younger <wry at ecoscentric dot com>
- To: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Tue, 23 Jun 2009 14:41:21 +0100
- Subject: Re: [ECOS] How to know if the scheduler is already running
- References: <4A40AD28.2080205@meduna.org>
Stanislav Meduna wrote:
> How can I know in a constructor code, whether it is safe
> to call the mutexes/conditions/...? I have no problem to revert
> to the polled mode in the startup code, if I know when
> it is safe to switch to the interrupt-driven one.
I ran into a very similar issue with my NAND driver work recently, though it
manifested as an assertion failure for me (I had CYGPKG_INFRA_DEBUG switched
on).
There are many ways to skin this particular cat. What I did (with Nick's
blessing) was to test whether
(cyg_thread_self() == cyg_thread_idle_thread())
- if they are equal, then it's a pretty safe conclusion that the scheduler
has not yet started.
Ross
--
Embedded Software Engineer, eCosCentric Limited.
Barnwell House, Barnwell Drive, Cambridge CB5 8UU, UK.
Registered in England no. 4422071. www.ecoscentric.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss