Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-27 14:47:29

Markus Schöpflin:

> Hello,
> 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.

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