|
Boost Users : |
Subject: Re: [Boost-users] weak_ptr and thread safety
From: Pavel Shevaev (pacha.shevaev_at_[hidden])
Date: 2009-07-22 15:38:15
> It's safe, presuming your "p" in thread A is a different shared_ptr object
> from the "p" reset in thread B. They can safely be copies sharing ownership
> of the same object.
Oh, sorry for the confusing example, it should be more clear:
//thread A:
shared_ptr<Foo> a = wp.lock(); //wp is a weak pointer for p from thread B
//thread B:
p.reset();
What I'm actually asking about whether it's thread safe to call
simultaneously wp.lock() in one thread and p.reset() in another one.
-- Best regards, Pavel
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