[ECOS] code fatal error!

Nick Garnett nickg@calivar.demon.co.uk
Tue Jul 23 10:46:00 GMT 2002


张 亮 <johnsonest@hotmail.com> writes:

> Hi,all!
>      in eCos,kill() function does not release mutex owned by thread
> which will be killed. I think it as a fatal error.right? or more wise
> machanism avoids this state?
> 

If a thread owns a mutex it is presumably for a reason -- to protect
some data against concurrent access. If you just kill a thread you are
likely to leave that data in an inconsistent state. Releasing the
mutex does nothing to solve this problem, it just exposes the
inconsistent data to other threads. 

The correct approach, as others have mentioned, is to arrange for
threads to shut themselves down in an orderly fashion. 

-- 
Nick Garnett - eCos Kernel Architect


--
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