Boost logo

Boost :

Subject: Re: [boost] threadpool lockfree_channel
From: Tim Blechmann (tim_at_[hidden])
Date: 2009-03-16 08:41:34


> Firstly, I'd like to help with this. I have a couple of lock-free queue
> implementations lying around from my book. I've attached a sample
> implementation that uses atomic reference-counting --- it would need to
> be "boostified", as it's written for C++0x, but that should be
> relatively straightforward. I don't make any claims for performance, but
> I believe it to be "correct", with no data races or undefined behaviour
> --- I *really* want to know if that's not the case, so I can correct it
> before the book goes to press.

while the implementation of your queue looks good to me, i am a bit
concerned about the use of dynamic memory allocation ... it is
`lockfree' in terms of the data structure implementation, but allocating
memory from the os (for node and T), its behavior is depending on the
new/delete implementation.

in my implementation pop is lockfree in any case, while push is lockfree
as long as the number of nodes does not exceed the preallocated node
count ...
while this may be negligible for an average-case scenario, it is quite
significant for the worst-case ...

tim

-- 
tim_at_[hidden]
http://tim.klingt.org
The price an artist pays for doing what he wants is that he has to do
it.
  William S. Burroughs



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