Boost logo

Boost :

Subject: Re: [boost] [thread] how to pass a parameter to threadfunc
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-10-24 05:47:40

<jon_zhou_at_[hidden]> writes:

> how to pass parameter to threadfunc
> seems it use function0<>

You must be using an old version of boost.thread. Boost.Thread hasn't
relied on boost.function since v1.35.

Since boost 1.36 you have been able to pass arguments to the thread

boost::thread t(func,arg1,arg2);

You can always use boost.bind:

boost::thread t(boost::bind(func,arg1,arg2));

This should work with older versions of boost.thread too.


Anthony Williams            | Just Software Solutions Ltd
Custom Software Development |
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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