|
Boost : |
From: Trevor Taylor (xju_at_[hidden])
Date: 2003-05-27 04:42:43
>
> 2. The pthread_mutex based version is suboptimal, both space- and
> performance wise. The problem here is that it is difficult to fix portably.
> On most platforms with a suboptimal (for our purposes, not in general)
> pthread_mutex, it is possible to implement a platform-specific shared_ptr
> that is no more than ~1.2 - 2.0 times slower than the unsynchronized version
> and doesn't use much extra space. In 95%+ of the cases (statistic made up on
> the spot) this performance difference doesn't even register on the profiler.
> Maybe one day we'll have a pthread_refcount_t. ;-)
>
:
>
> So I believe that long term, it is in the best interest of the C++ community
> to not introduce a threading model policy. We'll continue to receive user
> complaints until (2) is fixed, though. :-(
Why wait? With so many people contributing to boost, why not introduce a
pthread_refcount_t into into boost threads (or is there one already?),
provide a default implementation equivalent to what shared_ptr does now,
and let the platform experts provide the optimal specialisations.
Trevor
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk