|
Boost Users : |
Subject: Re: [Boost-users] why lockfree/queue.hpp requires has_trivial_assign and has_trivial_destructor to template type T
From: ºÎ×Ó½ÜHzj_jie (hzj_jie_at_[hidden])
Date: 2014-08-04 05:42:02
p.s. i am using boost 1.55 official release. but in boost 1.56, lockfree queue also has the same requirement.
.Hzj_jie
From: hzj_jie_at_[hidden]
To: boost-users_at_[hidden]
Subject: why lockfree/queue.hpp requires has_trivial_assign and has_trivial_destructor to template type T
Date: Mon, 4 Aug 2014 09:39:36 +0000
hi, all,as new to boost, i am looking for a solution to combine boost::lockfree::queue with std::function, i.e. boot::lockfree::queue<std::function>, but unfortunately, the implementation of the lockfree queue required the T to be trivial assignable and trivial destructible.with some basic investigation to the implementation of boost::lockfree::queue, the assignment operator is using when pop or unsynchronized_pop, it calls detail::copy_payload, which is using operator= or constructor and operator=. though overloaded assignment operator may use more time and cause the pop function to wait for longer time, i do not see it would block the logic.for the destruction, queue implementation always calls pool.template destruct instead deallocate, which means even for a default destructor, it will also be called.
so is this a defect or by-design behavior of the lockfree queue?
thank you in advanced.
.Hzj_jie
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net