
14 Jan
2009
14 Jan
'09
1:06 p.m.
Eric Greveson wrote:
I've recently been doing some work that required thread-safe containers (queue, channel) and I found that in addition to these, a locking_ptr with similar semantics to boost::shared_ptr (except being thread-safe too)
shared_ptr is already thread-safe. Did you mean you perform a lock around the access to the wrapped pointer? Why is it tied to shared ownership? This should be distinct things. Apart from that, if I were to use a thread-safe queue, I would probably use one designed for maximum efficiency using lock-free techniques, rather than one designed in terms of naive locking. Intel TBB provides that kind of thing already; and there had been discussion of integrating TBB into Boost in the past.