Boost logo

Boost :

From: Steven E. Harris (seh_at_[hidden])
Date: 2005-10-03 14:27:21


"Peter Dimov" <pdimov_at_[hidden]> writes:

> One argument against your enhancements is that (to the untrained
> eye) they seem to mandate a lock-based implementation. I wanted to
> permit a lock-free implementation, if possible.

Guilty as charged. At the time I designed this class, I had never
studied lock-free programming techniques.

The focus on these "front" handles came partly from thinking about
std::stack's and std::queue's top()/front() and pop() separation. Just
as exception safety requirements prevent these two operations from
being merged, concurrency requirements prevent them from being
separated -- without some kind of a lock.

I haven't thought it through much, but I doubt the same idea
(exclusive by-reference access to the queue head) could translate to a
lock-free interface.

-- 
Steven E. Harris

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk