Boost logo

Boost :

Subject: Re: [boost] [lockfree] Faulty (?) static assert
From: Tim Blechmann (tim_at_[hidden])
Date: 2012-09-02 05:56:52

hello hartmut,

> The lockfree::queue constructors raise a static assert if no capacity is
> specified. This contradicts the member initialization code close to the
> assert, for instance:
> queue(void):
> head_(tagged_node_handle(0, 0)),
> tail_(tagged_node_handle(0, 0)),
> pool(node_allocator(), has_capacity ? capacity : 0)
> {
> BOOST_STATIC_ASSERT(has_capacity);
> initialize();
> }
> which implies that 'has_capacity' is allowed to be false. From what I can
> see 'has_capacity' could be false, indeed, in particular if the queue is not
> bounded in size.

the idea is that the default constructor is only allowed, when the
capacity is set at compile-time. otherwise the data structure won't be
completely lockfree, as creating new nodes will hit the memory allocator.
so the assertion is correct, but the initialization of the pool can be

cheers, tim

Boost list run by bdawes at, gregod at, cpdaniel at, john at