Boost logo

Boost :

Subject: Re: [boost] Building ThreadPool with boost::function in boost::lockfree::queue
From: Tim Blechmann (tim_at_[hidden])
Date: 2013-04-01 11:51:14

> In file included from TestFunctionCompleteness.cpp:11:0:
> /usr/local/boost_1_53_0/include/boost/lockfree/queue.hpp: In instantiation
> of ‘class boost::lockfree::queue<boost::function<void()> >’:
> TestFunctionCompleteness.cpp:42:17: required from here
> /usr/local/boost_1_53_0/include/boost/lockfree/queue.hpp:79:5: error:
> static assertion failed: (boost::has_trivial_destructor<T>::value)
> /usr/local/boost_1_53_0/include/boost/lockfree/queue.hpp:83:5: error:
> static assertion failed: (boost::has_trivial_assign<T>::value)
> Is boost::function somehow an incomplete type and not expected to work in
> boost::lockfree::queue or is this a bug in the queue implementation? Can
> anyone suggest a simple workaround?

as the error message implies: boost::function is not trivially
assignable and does not have a trivial destructor. so it cannot be used
with boost::lockfree::queue.

possible workaround: use a functor that meets these requirements

hth, tim

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