|
Boost Users : |
Subject: Re: [Boost-users] boost:shared_ptr destructor, SIGBUS, MIPS 64
From: sumanth krishna (sumanth987_at_[hidden])
Date: 2012-01-05 06:30:33
@Peter:
You were right, one of the threads was explicitly deleting the list and
hence the cause for the crash. Thanks for your help.
-Samm
On Thu, Jan 5, 2012 at 3:38 AM, Peter Dimov <pdimov_at_[hidden]> wrote:
> sumanth krishna wrote:
>
>> C is a singleton class and from the logs i can see that the other threads
>> have exited before the destructor of C is called.
>>
>
> Well, in this case you should try to isolate a complete program that
> crashes and post it here.
>
> Even if the thread calls c->getList after ~C is executed, then also it
>> should not cause a problem because until all the instances are deleted and
>> reference count of the shared pointers reaches zero the memory for the
>> allocated class should not be deleted.
>>
>
> No, destroying a shared_ptr in one thread and copying it from another
> doesn't work. Even if it did, destroying a std::list in one thread and
> iterating over it from another doesn't work either. If you access an object
> from more than one thread, all accesses must be read (non-modifying)
> accesses.
> ______________________________**_________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/**mailman/listinfo.cgi/boost-**users
>
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