This is the mail archive of the
mailing list for the glibc project.
Re: pthread_create()'s behavor?
On Tue, Apr 17, 2012 at 4:28 PM, Hei Chan <email@example.com> wrote:
> Any hint?
The problem is that you are *destructing* the map (and the A object which
contains it) in thread T0, while your other thread T1 is still accessing it.
You need to wait for T1 to finish before returning from main (which
One way to achieve this is to make "thread" a member variable of A, and
to call pthread_join() in A::~A(). You should also *not* detach the thread.