Recursive mutex locks

"Stephen R. van den Berg" <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
This is how I want it to work:

Thread A, locks mutex Q.
Thread A then hands over the mutex to thread B.
Thread B does some processing.
In Thread A tries to lock mutex Q again, blocks waiting for the mutex to become
available. (*)
Thread B does some more processing.
Thread B releases mutex Q.
Thread A starts over at the top (and locks mutex Q).

This (obviously) doesn't work, because at point (*) I get an error
back saying: "Recursive mutex locks!"

Well, I understand what it is complaining about, but how do I "donate"
a mutex to another thread?  Or is there a way to tell the mutex library
to ignore the fact that it's the same thread that tries to lock it?
-- 
Stephen.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.