Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2007-10-30 13:16:58


"Hartmut Kaiser" <hartmut.kaiser_at_[hidden]> writes:

> Peter Dimov wrote:
>
>> > the multi platform failures observed for grammar_mt_tests and
>> > owi_mt_tests seem to correlate to the recent thread lib update:
>> >
>> > cxx: Error: ../boost/thread/pthread/thread.hpp, line 139:
>> call of an
>> > object
>> > of a class type without appropriate operator() or
>> conversion
>> > functions to pointer-to-function type (badcallclsobj)
>> > detected during instantiation of "void
>> > boost::thread::thread_data<F>::run() [with
>> >
>> > F=boost::reference_wrapper<single_grammar_object_task>]"
>> > f();
>> > ----------------^
>> >
>> > Anyone knows what's going on?
>>
>> I think I do. The new Boost.Threads implements the proposed
>> standard interface where F is expected to be a function
>> object; std::reference_wrapper is, but
>> boost::reference_wrapper isn't. The old Boost.Threads did not
>> suffer from this problem since it stored F in a
>> boost::function, which automatically recognizes
>> reference_wrapper and "dereferences" it before the call.
>>
>> This can be fixed on the user side by wrapping the
>> reference_wrapper in a boost::bind, or it can be fixed on the
>> Boost.Threads side. The third option, making
>> boost::reference_wrapper callable, is a very risky change
>> that I would advise against.
>
> I strongly object against silently changing the Boost.Thread
> interface/semantics. So I'ld vote for 2)

I've checked in an update to Boost.Thread that handles
boost::reference_wrapper specially.

Anthony

-- 
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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