[ECOS] R: [ECOS] Thread identification

Nick Garnett nickg@ecoscentric.com
Tue May 27 19:49:00 GMT 2003


"Michele Portolan" <michele.Portolan@imag.fr> writes:

> I'm conducting a study on fault tolerance, so I need to know which thread
> had been interrupted to try to recover the error.

Getting the identity of the current thread for simple monitoring
purposes is probably OK. However, if you want to try an affect the
state of the thread then you are on shaky ground. Interrupts can
happen even while a thread is in an inconsistent state, since thread
state is protected by the scheduler lock and not by disabling
interrupts. Any attempt to manipulate a thread from an ISR will result
in undefined behaviour.


> Does cyg_thread_self works also inside an exception?

Yes. In this case you are in safer territory since exceptions are
synchronous with the current thread and any exception raised should
see the thread in a consistent state -- unless something is seriously
wrong and the kernel has hit an exception.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list