On Dec 2, 11:15 pm, JackC <jeche...@gmail.comwrote:
I create my threads like this:
for(int j = 0; j < 5; j++)
{
boost::thread *thr = new boost::thread(worker_func);
threads.add_thread(thr);
}
How would i go about passing a parameter into the worker
function? If possible i would like to pass a structure in.
The worker function is a boost::function, so you can pass it
pretty much anything that's copiable. Be aware that it will be
copied, however; if you want to access it later in the parent
thread (say after a join), then you need to pass a pointer (or
maybe a reference).
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34