On Sat, 2002-02-16 at 10:50, Peter Dimov wrote:
From: "Colin Fox"
I got the CVS version of boost, which you suggested, and had my
From: "Colin Fox"
running all night last night. No problems so far. Perhaps this solves it.
Let's hope so. I presume you're on a multiprocessor? Could you please also try my latest attempt, that uses lwm_linux.hpp on linux instead of the generic lwm_pthreads.hpp? It's much faster than the pthreads version when there's no contention but there's no point being faster if it's incorrect.
Yes, I forgot to mention that - I'm developing on a dual processor box.
I kind of suspected that. This probably means that the atomic_* functions don't synchronize memory (they are supposed to, but...)
How do I try the latest attempt? Is that what's in CVS, or do I need something else?
Yes, it's in CVS. I've also added a test for thread safety, libs/smart_ptr/shared_ptr_mt_test.cpp.
Speed will become important, because eventually this is going to have to handle a fairly high thread & activity load. But I completely agree that correctness comes first. :)
Copying a shared_ptr is about 3.4 times faster with the specialized version, but it depends on atomic_inc and atomic_dec_and_test as well, so it probably won't work. Oh well.