Boost logo

Boost Users :

Subject: Re: [Boost-users] why lockfree/queue.hpp requires has_trivial_assign and has_trivial_destructor to template type T
From: Bjorn Reese (breese_at_[hidden])
Date: 2014-08-05 07:52:42

On 08/05/2014 08:48 AM, 何子杰Hzj_jie wrote:

> it looks like an implementation limitation to me. the pointer surely
> works, but it will cause trouble about the instance lifetime. my

I believe that the limitation is inherited from atomic<>. If it is any
consolation, there is ongoing work to allow smart pointers in atomic<>:

> scenario is a threadpool, which will work on functions / lambdas
> [function<bool(void)>], so let the threadpool queue keeps the instances
> would be an easy approach. but multi-produce-multi-consume is required.

By only having the next available thread listening on the consumer side
you can reduce this to MCSP. See the Leader/Followers architectural
pattern on how this can be done (but do notice that the threadpool has

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at