[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANNOUNCE]: LuaThreads 1.0-work, pre-release
- From: Diego Fernandes Nehab <diego@...>
- Date: Thu, 13 Dec 2001 02:37:34 -0200 (BRST)
> This can make design of larger scale systems difficult, at best, and
> the problem is only worse when dealing with other people's libraries.
> Basically short of searching the source code (if you have it), you
> really must assume that it is not safe to call a function that affects
> an object protected by a mutex you currently hold; which goes against
> the idea of the mutex in the first place.
I agree that recursive mutexes are nice for these examples, but think
about the effect on condition variables. If you use a recursive mutex
and you have two locks on the mutex associated to the predicate, the
implicit unlock performed by the wait function will not release the
mutex. If this happens, no other thread will be able to change the
predicate, and we get a deadlock. I am not sure which bug will be harder
I will see how hard it is to provide recursive mutexes to LuaThreads in
Linux, Solaris, AIX and IRIX. recursive mutexes are not portable as far
as I know. If I manage to get them all working, I might add a parameter
to newmutex(), to specify the kind of mutex to be created. I don't like
the extra complexity, though. Besides, I am not sure if it is easy to
create a non-recursive (and reasonably fast) mutex in Win32.