|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-02-13 15:18:56
Don G wrote:
> Hi All,
>
> For my own work in the thread-safe smart pointer arena, I have used a
> technique to reduce the number of mutex objects from one per object,
> yet minimize induced contention. The basic idea is a static pool
> of mutexes indexed by hashed pointers. [...]
> Has anyone considered using this technique in shared_count?
Yes, I had considered a mutex pool. One problem is that boost::shared_ptr is
header-only, and must remain so for backward compatibility reasons. Another
problem is that a CRITICAL_SECTION needs to be dynamically initialized
before use, but the initialization itself also needs synchronization.
It is easy to apply this optimization to std::tr1::shared_ptr, though, since
standard libraries don't need to be header-only and can initialize things
before everything else. ;-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk