Tristan King wrote:
Rene Rivera wrote:
Or just don't use boost:ref, and have the thread function objects copied.
Rene, is that possible with a stuct?
Yes, as long as it has default and copy ctors (or usually the auto generated ones).
the problem is that i need give the thread some initial parameters, and i'm not sure if thats possible using a simple function.
The most elegant solution is to use Boost.Bind. For example your
original code could be written as such:
#include <iostream>
#include
if a thread is created using new simple_thread* trd = new simple_thread( p ); and started using: threads.create_thread( boost::ref( *trd ) ); trd still needs to be destroyed using "delete" somewhere right?
Yes.
or will the memory be free'd when the thread finishes execution?
No. HTH. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq