Passing parameters to a thread
I've been using threading for a while, that was no needing parameters..
so I used for example the following line :
_beginthread(functionName, 0, (void*)10);
and it worked great...
but now I have a function that has an int parameter (int num), and I dont know how to transfer it using _beginthread...
I searched the net, but didnt found a solution for this...
I don't think this is standard C++. I guess I can only show you C++11 <thread> functionality.
Otherwise, ask in the Windows programming subforum about this specific function (It is Windows, right?)
void aux(int &a)
std::cin >> a;
std::thread thr(aux, std::ref(a));
std::cout << a;
Topic archived. No new replies allowed.