
Hello all, [long story short: I'd like to know whether a weak_ptr.lock() counts as a "shared pointer read" or as a "shared pointer write" ] I'm using boost shared pointers in an multi-threaded app. Basically, my app maintains a "forest" of "context trees" - i.e. I have a map from a "file name" to a "global context" that organizes the information for that file. The "global context" in the map is basically the root node of a tree of "local contexts" in that file. The tree is kept with boost:shared_ptr<> on the way down (father-son relations) and boost::weak_ptr<> on the way up (son->father pointers). I have added proper synchronization to the data structure... I think. I use reader/writer locks (only one writer allowed, but arbitrary number of readers) and I'm still getting sporadic crashes, especially when constructing a "global context" (root node) shared_ptr<> from a weak_ptr<> - using lock(). I am assuming in my app. that weak_ptr<>.lock() only requires a "read lock", not a "write lock".. is this true? I've checked out the page at http://www.boost.org/doc/libs/1_41_0/libs/smart_ptr/shared_ptr.htm#ThreadSaf..., but there's nothing about weak_ptr there... Thanks, Virgil.