When using the pthreads recursive mutex, the level method was only able to return either zero or one, but a recursive mutex can be locked more than once. Additionally, the way this detected if the mutex was already locked was to test whether it can be locked again. If testing from the thread that is currently holding the lock, this locking attempt always succeeds, and therefore determines that the lock is _not_ held at all. This is especially bad, as this operation only makes sense to perform from the thread that holds the lock -- if any thread not holding the lock queries the number of times the lock is held, that answer can change before the thread can used it. Signed-off-by: Bobby Bingham <koorogi@koorogi.info>pull/68/head
parent
4ff2cb8b3c
commit
999cebcb5d
Loading…
Reference in new issue