|
Boost : |
From: Tom Widmer (tom_usenet_at_[hidden])
Date: 2004-03-08 05:19:36
On Fri, 5 Mar 2004 11:43:12 -0800, "John McGinty" <john_at_[hidden]>
wrote:
>Is there any reason why shared_ptr does not use atomic_count (using
>InterlockedIncrement, InterlockedDecrement) for the reference count?
>The lightweight mutex used to protect the count in the current
>implementation is a spin lock that sleeps when contended. Using
>atomic count would offer performance improvements in both the
>uncontended and contended cases.
You can't atomically modify two variables at once without some kind of
mutex but there are two reference counts. I suspect that's the reason.
Tom
-- C++ FAQ: http://www.parashift.com/c++-faq-lite/ C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk