Passing Parameters To Function Called By Start Thread

Nov 19, 2012 at 11:53pm
I have a function uci()

it works when it is initiated in a thread with the following commmand:

Thread^ newThread = gcnew Thread( gcnew ThreadStart(&uci));
newThread->Start();

However, when I require uci() to receive a parameter say uci(class * cPointer),
it fails.
Nov 20, 2012 at 4:54am
Your question should belong to the "Windows Programming" section as it is about use of C++/CLI.

I am not very familiar with C++/CLI, but looking at the API reference, you would want to use the ParameterizedThreadStart delegate instead, then pass your argument to the Thread::Start method.
Nov 20, 2012 at 6:47am
Alright. I guess this is Windows specific, so how do I implement threading that would work in all platforms? And How do I pass the variables?
Nov 20, 2012 at 10:31am
Take a look at boost:

http://www.boost.org/doc/libs/1_52_0/doc/html/thread.html


C++11 also has thread support
Topic archived. No new replies allowed.