apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Reid" <dr...@jetnet.co.uk>
Subject Re: nested mutexes
Date Tue, 19 Jun 2001 16:06:37 GMT
If we already own a lock we should be able to lock it again shouldn't we?

Part of the problem was my initial assumption that if we didn't have threads
we didn't have locks, but of course we do :) Jeff's suggestion of using the
pid was a good one I think to get us around this problem.  Are you adding
that Jeff or did you want me to?

david

> On 19 Jun 2001, Jeff Trawick wrote:
>
> | no, by "nested mutex" I mean that this is allowed
> |
> | Thread A holds mutex 1
> | Thread A obtains mutex 1 again
> |
> | what I call "nested mutex acquire" is sometimes called "recursive
> | mutex acquire"
>
> Wouldnt an attempt to aquire a mutex that is already owned (by the
> calling thread or another thread) fail with EDEADLK, so anything obtaining
> something more than once is not possible without error?
>
> Perhaps something like a "mutex keychain" would be good to help a thread
> keep track of mutexes it currently owns/are globaly owned so that attempts
> to aquire owned ones would be thwarted?


Mime
View raw message