Boost logo

Boost :

Subject: [boost] [Thread] Non-copyable boost::thread
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2010-05-14 15:57:27


Hi,

The Boost.Thread documentation points out that boost::thread is non-
copyable but then goes on to provide rational for why it should be
possible to return by value from make_thread_return_local().
Intel-11.1 on Darwin is a recent compiler that will not compile this
code.

[ from libs/thread/test/test_thread_return_local.cpp ]

boost::thread make_thread_return_local(boost::thread::id* the_id)
{
     boost::thread t(do_nothing,the_id);
     return t;
}

The same error message is generated in both debug and release builds
on Darwin (though strangely it doesn't appear to be an error with
Intel 11.1 on Linux).

"/opt/intel/Compiler/11.1/067/bin/intel64/icpc" -xc++ -w1 -O0 -g -
inline-level=0 -vec-report0 -DBOOST_ALL_NO_LIB=1 -
DBOOST_TEST_NO_AUTO_LINK=1 -DBOOST_THREAD_POSIX -
DBOOST_THREAD_USE_LIB=1 -I".." -c -o "/Volumes/Scratch/kbelco/boost/
results/boost/bin.v2/libs/thread/test/
test_thread_return_local_lib.test/intel-darwin-11.1/debug/threading-
multi/test_thread_return_local.o" "../libs/thread/test/
test_thread_return_local.cpp"

../libs/thread/test/test_thread_return_local.cpp(16): error #373:
"boost::thread::thread(boost::thread &)" (declared at line 111 of "../
boost/thread/detail/thread.hpp") is inaccessible
       return t;
              ^

Any ideas how to work around this failure?

Thanks.

-- Noel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk