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: code fatal error!


ÕÅ ÁÁ <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


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