This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: mutexes again
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: Ronald Tubben <r dot tubben at mauell dot nl>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: 30 Jan 2004 15:07:20 +0000
- Subject: Re: [ECOS] mutexes again
- References: <401A6448.7080903@mauell.nl>
Ronald Tubben <r.tubben@mauell.nl> writes:
> Hi,
> Yesterday I made this mistake by forgetting to initialize a mutex by
> cyg_mutex_init.
> So I wrote a class for it. In the constructor of the class the mutex
> is being initiated (this option can be disabled and later intiated).
> My question is:
> Are theire performance or other disadvantages to do this so?
> An advantage is the implimentation of the cyg_mutex_status() which
> returns the status of a mutex and the cyg_mutex_testunlock()
If you mean having an explicit initialization: it is rather hard to
design a mutex implementation in which all fields zero is a valid
initial state. Mutexes embedded in dynamically allocated data
structures could have totally random values. So there is no real
option but to expect a mutex to have been initialized before use.
--
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