Can someone post a simple example of starting two (Object Oriented) threads in C++.
I'm looking for actual C++ thread objects that I can extend run methods on (or something similar) as opposed to calling a C-style thread library.
Update - I left out any OS specific requests in the hopes that whoever replied would reply with cross platform libraries to use. I'm just making that explicit now.
If you have a C++11 or higher compiler available you can use the C++ std::thread implementation which allows you to pass a function or a lambda to them to execute in parallel. You can also pass pointers to member functions and pass arguments through the std::thread interface
Here's an example:
#include <thread>
#include <iostream>
int main(int argc, char** argv) {
// Example using a C++11 anonymous function (lambda)