Boost logo

Boost Users :

From: Jonathan Biggar (yg-boost-users_at_[hidden])
Date: 2003-07-31 22:52:34


Jason Winnebeck wrote:

> The drawback is that you can't do
>
>something like this with the RAII methods.
>
>mtx.lock();
>mtx2.lock();
>mtx.release();
>mtx2.release();
>
>But I've never seen a case so far where I'm required to do that.
>
One use case for that that I'm aware of is when you want to have
multiple concurrent searches/modifies in a tree datastructure. You can
lock a parent node, scan the children nodes to find the one you want,
lock the child and then release the parent so that another search can
get to a sibling object before you are finished with the child node.

-- 
Jonathan Biggar
jon_at_[hidden]
jon_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net