I was trying to find the answer for some time but I failed.
Lets assume that we have a shared_ptr created from one thread. Then we pass this shared_ptr to another 2 threads (using some queue for example). So from this moment there are 2 copies of the original shared_ptr, pointing to the same raw pointer.
Both owner threads will take their copies of this shared_ptr from the queue. Then they will pass it to another thread or will destroy it.
Question is – is it safe? Will the raw pointer destroyed correctly (there will be no race to reference counter?)

The boost docs state:
(emphasis mine)
So the crux here is whether you copy the
boost::shared_ptrs between threads or not. If you create copies (the “safe” way to useshared_ptrs) you don’t have any worries about thread-safety. If however you pass theshared_ptrby reference or pointer, and hence are using the actual sameshared_ptrin different threads, you would have to worry about thread-safety, as described in the docs.