On Fri, 2002-02-15 at 11:31, Peter Dimov wrote:
From: "Colin Fox"
<..> I'm using gcc 3.0.3 on Linux, and boost 1.27.
Can you simplify the program to the bare minimum that still has the
From: "Colin Fox"
Not very easily, but if I can't make any progress, I'll do that.
OK, let me explain the exact level of thread safety provided by shared_ptr; it might be of help. shared_ptr (in 1.27+) is (should be) thread neutral. A class X is thread neutral when: * Accessing two different objects of class X is safe, even when they are equivalent copies; * Accessing the same object is safe only when all accesses are read accesses; otherwise the behavior is undefined. For example, under the pthreads memory model all C types are thread neutral. This means that: shared_ptr p; // thread 1 shared_ptr q(p); // read p // thread 2 shared_ptr r(p); // read p is safe. // thread 1 q.reset(); // write q // thread 2 r.reset(); // write r is safe. // thread 1 shared_ptr s(p); // read p // thread 2 p.reset(); // write p is undefined behavior. If your program doesn't read/write or write/write (to) the same shared_ptr simultaneously, and still misbehaves, then there is a bug in shared_ptr that we'll have to track down.