Boost logo

Boost :

Subject: Re: [boost] Boost.Thread: Support for variadic templates
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2011-03-09 11:10:13


Daniel Neuberger <daniel.neuberger_at_[hidden]> writes:

> On 03/09/2011 03:07 AM, Anthony Williams wrote:
>> Boost.Thread relies on boost::bind. As such, it won't support variadic
>> templates until boost::bind does.
> Any idea when boost::bind will support variadic templates?

No.

> Any reason Boost.Thread couldn't add the option to use std::bind
> instead?

It's more work for me ;-)

>>> We'd use c++0x, but it looks like there's no plan to support
>>> timed_join and interruption/cancellation.
>>
>> You're right: interruption was too controversial, and timed_join imposes
>> too much overhead on some implementations. If you need the equivalent,
>> use std::async(std::launch::async,thread_func) to start your thread, and
>> use wait_for/wait_until on the returned std::future.
> Any there any workarounds for interruption? Possibly using Boost?

Interruption is invasive. Every function you wish to be an interruption
point has to be wrapped with interruption checks, and you'll have to
wrap the thread object with something that can hold the interruption
data. Take a look at the implementation of interruption for pthreads in
boost trunk, to see the convolutions necessary just for interruptible
condition variable waits.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

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