[thread][move] compiling move(thread) with Android NDK GCC4.7

Hello,
I'm building my project with Android NDK toolchain (Boost1.51, GCC4.6
or GCC4.7), and I get the following error when trying to move thread.
Is there any workaround for this issue?
//...
vector_.push_back(boost::move(thread(&func, arg)));
//...
try.cpp:86:62: error: no matching function for call to 'move(boost::thread)'
try.cpp:86:62: note: candidates are:
In file included from boost/thread/detail/move.hpp:20:0,
from boost/thread/locks.hpp:11,
from boost/thread/pthread/mutex.hpp:12,
from boost/thread/mutex.hpp:16,
from boost/thread/pthread/thread_data.hpp:13,
from boost/thread/thread.hpp:17,
from boost/thread.hpp:13,
from try.h:3,
from try.cpp:6:
boost/move/move.hpp:324:97: note: template<class T> typename
boost::move_detail::disable_if

std::vectorboost::thread but even without push_back() it fails to compile.

On Mon, Jan 14, 2013 at 5:43 AM, Igor R
I believe you can only "boost::move" an lvalue. Aside from that, if you're using a C++03 std::vector, I don't think it'll be aware of the move semantics of boost::thread (just guessing on the types of your variables though, since you didn't spell them out), so I would expect this to trigger an error somewhere inside vector::push_back even if the move call compiled. try.cpp:86:62: error: no matching function for call to 'move(boost::thread)'
I'm a little surprised by this diagnostic (I would've thought has_move_emulation_enabledboost::thread::value == true); hmmm...
Oh, okay, I guess boost::thread has its own move emulation infrastructure distinct from Boost.Move :( Still, first comment above still applies. In file included from boost/thread/locks.hpp:11:0,
HTH, - Jeff

On Wed, Jan 16, 2013 at 1:27 AM, Igor R
One suggestion: lobby for Boost.Thread to adopt Boost.Move rather than its own internal move emulation machinery (or, better yet, supply a patch!), and additionally use the Boost.Container data structures, which are Boost.Move-aware AFAIK. - Jeff

Le 16/01/13 18:38, Jeffrey Lee Hellrung, Jr. a écrit :
Boost.Thread make use of Boost.Move when BOOST_THREAD_USES_MOVE is defined and can be used with Boost.Container or any standard c++ container. The problem is that it doesn't provides both emulations at once. Vicente

On Wed, Jan 16, 2013 at 10:06 AM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Remind me what the limitation of Boost.Move's emulation are wrt Boost.Thread, and how Boost.Thread's internal emulation avoids that limitation? - Jeff

Le 17/01/13 03:34, Jeffrey Lee Hellrung, Jr. a écrit :
You misunderstood my concern. Boost.Move has no specific limitations with respect to Boost.Thread. Boost.Thread internal(old) emulation has more troubles than the one provided by Boost.Move. I forgot to tell that BOOST_THREAD_USES_MOVE is defined by default when BOOST_THREAD_VERSION >= 3. As the default version has not been changed to version 3 in 1.53 as planned BOOST_THREAD_USES_MOVE is still not defined. I'm all for defining BOOST_THREAD_USES_MOVE even for version 2, but this will changes the interface. Comments of those that were against moving to version 3. Best, Vicente
participants (3)
-
Igor R
-
Jeffrey Lee Hellrung, Jr.
-
Vicente J. Botet Escriba