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: function executed under idle thread context


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


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