Boost Users :
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-15 14:31:48
From: "Colin Fox" <cfox_at_[hidden]>
> Greetings, everyone.
> I'm currently having some trouble with a heavily multithreaded app which
> uses objects shared between threads via smart pointers.
> It's a multi-user application, where each user has a thread, and when
> one user sends a message to another (or broadcasts to all), a message
> object is created, and a smart pointer to that message is put into a
> queue for each thread.
> I'm using pthread_mutex for locking the queues for each thread.
> This program will sometimes work flawlessly for hours, and other times
> it will die within moments of starting. Pretty much every time it dies,
> it's because the message object has been freed while there are still
> smart pointers pointing to it.
> I know that the recent version of the smart pointer library was supposed
> to have added thread-safety to it, but I'm wondering if anyone else is
> having similar troubles.
> 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 problem?
Also, does the CVS version of shared_ptr work? (It now uses a pthread_mutex
on Linux and not atomic intructions.)
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