This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: code fatal error!
- From: Nick Garnett <nickg at calivar dot demon dot co dot uk>
- To: =?gb2312?b?1cUgwcE=?= <johnsonest at hotmail dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: 23 Jul 2002 16:01:51 +0100
- Subject: Re: [ECOS] code fatal error!
- References: <F142OkTRhlQnNE6f17r00018cb8@hotmail.com>
ÕÅ ÁÁ <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