Boost logo

Boost :

Subject: Re: [boost] boost.lockfree update
From: Christian Holmquist (c.holmquist_at_[hidden])
Date: 2010-07-23 14:40:54


On 23 July 2010 06:24, Tim Blechmann <tim_at_[hidden]> wrote:

> hi all,
>
> i've did some updates to boost.lockfree the biggest difference to earlier
> snapshots is, that it includes a fixed-size single-producer/single-consumer
> ringbuffer.
>
> besides, the documentation is based on doxygen now. snapshots are available
> from [1], docs from [2] and my git repository can be found at [3] and
> cloned
> from [4]...
>
>
Hi,

This looks like a really useful addition to boost, hope you'll push it for
review at some point.

Some quick feedback on the fifo class

Fifo:
"The fifo class provides a multi-writer/multi-reader fifo, enqueueing and
dequeueing is lockfree, construction/destruction has to be synchronized"

What does it mean that construction/destruction has to be synchronized? Both
these functions can only be called once.

    fifo(void):
        pool(128)
    {
        initialize();
    }

I would prefer having the default constructor to not allocate any memory at
all. Why not expose a reserve() member function instead?

bool enqueue(T const & t);
Shouldn't this function throw an exception if t cannot be enqueued?
Can the name be changed to push_back() instead, to mimic other
std::containers? One may then, for instance, use your class with
std::back_inserter

Suggestion
void push_back(const T&) // Throws...

bool dequeue (T * ret)
I think T should be taken by reference instead of pointer:
Suggestion:
bool pop_front(T&)
or
try_pop_front(T&)

bool empty(void) //warning Not thread-safe
I think this function should be removed from public interface if it cannot
be implemented in a thread safe manner.

Cheers,
Christian


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