[ECOS] reentrant mutex
Mon Apr 14 14:32:00 GMT 2003
Jonathan Larmour <jifl@eCosCentric.com> writes:
> Nick Garnett wrote:
> > I would personally not like to see such a patch. It would not work
> > very well with condition variables and any system that mixed regular
> > and recursive mutexes would be very hard to debug.
> I'm not sure it would make that much difference since they would be
> completely different types... I would agree that making a Cyg_Mutex
> have configurable behaviour would be bad and confusing. Similarly
> therefore, since condvars only take a Cyg_Mutex and not a
> Cyg_Recursive_Mutex (or whatever), it should be fine.
Mutexes without condition variables are not very useful. The two are
complimentary parts of a single synchronization mechanism. Taking the
patch idea to its logical conclusion, we would also need a set of
condition variables that took a recursive mutex. We would end up with
two independent parallel synchonization domains. That would be a
really nasty can of worms to open.
> Anyway, I just want to be sure that defining a recursive mutex as a
> completely different type would still not be acceptable.
I suspect that the only way of doing it is to add a runtime option to
the mutex implementation to support recursion. However this would
require some of the API to change and would need an
up-to-the-elbows-in-blood-and-guts rewrite of the mutex and condition
variable code, as well as lots of other bits of eCos. The degree of
instability this would introduce is probably not worth it for a
relatively minor change in external functionality.
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