This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: function executed under idle thread context
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Ajay Dudani <adudani at telesyn dot com>
- Cc: ecos-discuss at sources dot redhat dot com, bwani at telesyn dot com
- Date: Mon, 27 Sep 2004 19:35:31 +0200
- Subject: Re: [ECOS] function executed under idle thread context
- References: <001201c4a4a9$7a9d8b70$390810ac@telesyn.corp>
On Mon, Sep 27, 2004 at 11:48:48AM -0400, Ajay Dudani wrote:
> We are looking at 4 threads in our system
> - Idle thread
> - Init Thread (this creates the two threads mentioned below)
> - Timer (this thread gets executed every 10 ms)
> - App (this thread does most of the work)
>
> We have a utility function which wraps some debug code around
> cyg_mbox_put - that we expect to get executed under context of either
> Init thread, Timer thread or App thread.
>
> We added some debug code in the utility function to verify this. Using
> Cyg_Thread::self and getting the thread id inside the utility function
> shows that the utility function sometimes also gets executed under the
> context of idle thread.
>
> We have not changed/added any code to idle thread or architecture
> specific idle thread functions.
>
> Is there an issue with a scheduler or the way ISR/DSR's are handled that
> can cause this to happen?
ISR/DSR are not executed in thread context. This means if you call
Cyg_Thread::self in an ISR/DSR you get undefined results. These
undefined results may coincide with the thread IDs, but these values
are still undefined and should not be used for anything.....
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss