Boost logo

Boost :

Subject: Re: [boost] [Thread] Non-copyable boost::thread
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2010-05-17 17:15:20

On May 17, 2010, at 2:54 PM, Anthony Williams wrote:

> "Belcourt, Kenneth" <kbelco_at_[hidden]> writes:
>> On May 17, 2010, at 9:49 AM, vicente.botet wrote:
>>> From: "Belcourt, Kenneth" <kbelco_at_[hidden]>
>>> On May 17, 2010, at 2:25 AM, Anthony Williams wrote:
>>>>> "Belcourt, Kenneth" <kbelco_at_[hidden]> writes:
>>>>>> Intel-11.1 on Darwin is a recent compiler that will not compile
>>>>>> this code.
>>>>> Explicitly move the return value:
>>> If you are using Boost.Thread as I suspect, try
>>> return boost::move(t);

With this syntax the compiler gives the inaccessible message, though
it's a warning not an error.

>>> return boost::thread(boost::move(t));

But this works okay and is warnings free.

I've attached a patch that should fix this. Okay to commit?

> Vicente is right that I meant boost::move and boost::thread.

Right, I now see that, thanks.

> boost::move is overloaded for boost::thread and anything else that
> uses
> boost::thread_move, so the above should "just work".
> See libs/thread/test/test_thread_move.cpp and
> libs/thread/test/test_thread_move_return.cpp
>> Since Boost.Thread has it's own partial move implementation in
>> boost::detail::thread_move, it seems that some work is necessary to
>> integrate (or re-implement) thread_move in terms of boost::move.
>> That's why I thought I'd ping Anthony and see if this is even worth
>> considering.
> Yes, there's a bit of work necessary to integrate Boost.Thread move
> support and Boost.Move, but it should still support move semantics
> through its own mechanism in the mean time.
> As far as the specific test goes --- it's a characterisation test that
> identifies whether or not the platform/compiler supports the
> particular
> scenario. Some do, some don't. I think technically the ones that don't
> are more conforming under C++98, but it's a useful extension in this
> case. Under C++0x, with rvalue-ref move support, it is required to
> work.

Okay, thanks for the explanation.

We can't use Boost libraries that have failures though expected
failures are okay. That's why I'm trying to get Boost.Thread with
Intel on Darwin working.

I appreciate all the help.

-- Noel

Index: test_thread_return_local.cpp
--- test_thread_return_local.cpp (revision 62066)
+++ test_thread_return_local.cpp (working copy)
@@ -13,7 +13,11 @@
  boost::thread make_thread_return_local(boost::thread::id* the_id)
      boost::thread t(do_nothing,the_id);
+#if defined(__APPLE__) && defined(__INTEL_COMPILER)
+ return boost::thread(boost::move(t));
      return t;

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