Possible Duplicate:
Simple example of threading in C++
Can someone please give me an example how to create a simple application in C++ that runs two functions simultaneously? I know that this question have connections with thread management and multi-threading, but I’m basically a php programmer and I’m not really familiar with advanced C++ programming.
Here’s a simple example:
If your functions need to produce return values, you should combine the above thread objects with
std::packaged_taskrunnable objects, available from<future>, which give you access to the return value of the thread function.