The problem here is that you are trying to use a function for a ThreadStart
delegate which has an incompatible signature. ThreadStart
is a delegate which has no arguments and returns no value. You are trying to use a method though which takes 4 arguments. This won't work.
You'll need to instead pass in a method which takes no arguments.
To pass parameters in C++, your best bet is to create a new class which has all of the parameters as fields. Then give it a method which has no parameters and returns no value and use that as the ThreadStart
target.
ThreadHelper^ h = gcnew ThreadHelper();
h->Param1 = someValue;
ThreadStart^ threadDelegate = gcnew ThreadStart( h, &ThreadHelper::DoMoreWork );
There is a full example of this on the ThreadStart
documentation page
JaredPar
2009-10-25 18:28:14