Boost logo

Boost Users :

Subject: Re: [Boost-users] Passing arguments to threads
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-16 11:52:16


r ottmanj wrote:
> I am working on an application that takes use of boost::thread. During the
> initial method of my application I need to pass one argument to the method.
> As per the api documentation for boost::thread I am using the following:
> boost::thread dataThread(dparse.dataMain,instUUID);
> dataThread.join();
> However, when I attempt to use this, I get the following exception from my
> compiler. Is there something that I am missing? I do not see how my thread
> constructor is any different from the constructor in the api documentation.
> Any help with this is greatly appreciated.
> error: no matching function for call to ‘boost::thread::thread(<unresolved
> overloaded function type>, std::string&)’
> /usr/include/boost/thread/thread.hpp:38: note: candidates are:
> boost::thread::thread(const boost::function0<void,
> std::allocator<boost::function_base> >&)
> /usr/include/boost/thread/thread.hpp:37: note:
> boost::thread::thread()
> /usr/include/boost/thread/thread.hpp:35: note:
> boost::thread::thread(const boost::thread&)

It looks like you have an older version of Boost that
doesn't support extra arguments to the constructor.
You'll need to use Boost.Bind.

In Christ,
Steven Watanabe

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at