Subject: Re: [boost] [lockfree review] rfc: naming and interface
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-21 20:54:07
On Thu, Jul 21, 2011 at 2:46 AM, Tim Blechmann <tim_at_[hidden]> wrote:
> hi all,
> i am starting a new thread, because i want to start a new discussion on one
> aspect of boost.lockfree: the naming of the data structure and the
I hope to look through the documentation and provide some feedback before
the end of the review.
> the current names of the data structures are fifo, stack and ringbuffer.
> the pre-review some people suggested to use different names, lifo instead
> stack or queue instead of fifo.
> in general i think it is a good idea to use a consistent naming (probably
> should be renamed to queue), but how does the ringbuffer come in? it is a
> as well, but with different characteristics (spsc and wait-free).
Queue, stack, and ring seem fine.
data structure configuration:
> stack and fifo currently use 3 template arguments: T for the managed type,
> freelist_t as a tag to select the underlying freelist and Alloc as the
> which is used for the internal nodes:
> template<typename T,
> typename freelist_t = caching_freelist_t,
> typename Alloc = std::allocator<T> >
> class fifo/stack;
> however i have been thinking about replacing it with a boost.parameter
> interface, something like:
> template<typename T, ... Options>
> class fifo/stack;
> with the options:
> boost::lockfree::freelist_can_allocate<true/false> to disable memory
> allocation during enqueue/push
> boost::lockfree::allocator<> to specify the allocator
Boost.Parameter seems like overkill for just 2 optional parameters.
If you have plans for expanding the class of policies one can specify in the
> the ringbuffer currently has the signature:
> template<typename T, size_t max_size> class ringbuffer;
> if max_size is 0, the size of the ringbuffer can be configured at run-time
> a constructor. this is not really the cleanest interface, but i would like
> provide an interface, which supports both compile-time and run-time setting
> the size.
Actually, I think it's reasonably clean, if max_size defaults to 0, so that
a dynamic max_size ring is simply ring<T>.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk