← Back to team overview

linuxdcpp-team team mailing list archive

[Bug 617591] Re: Pointer.h/intrusive_ptr_base class is too heavy-weight

 

I just filled #617988 which replaces safeInc/safeDec-style counters in
Client.h/struct Counts - (3)

Now, the only consumer safeInc/Dec functions is BufferedSocket (2), for
which I suggest to just use <boost/details/atomic_count.hpp> with
appropriate comment. I can submit patch for that, if necessary.

safe* functions in FastCriticalSections was replaced in Bug #617757

Taking all this into account, we have only one use of "safe*" functions:
ShareManager::refresh (safeExchange), which I think should use try_lock
or semaphore instead.

-- 
Pointer.h/intrusive_ptr_base class is too heavy-weight
https://bugs.launchpad.net/bugs/617591
You received this bug notification because you are a member of LinuxDC++
Team, which is subscribed to LinuxDC++.

Status in DC++: New
Status in Linux DC++: Confirmed

Bug description:
"Pointer.h/intrusive_ptr_base" class is too heavy-weight (at least on unix), it uses pthread mutex for every increment/decrement. And since this mutex is static (Thread::mtx), it leads to bad concurrency even for independent intrusive pointers.
Patch attached, which uses portable atomic reference counters from boost.
It uses boost::detail::atomic_count from shared_ptr, so it may theoretically change in future (since it is in detail), but I doubt it will.





References