//g++ -std=c++11 -pthread 1.cpp
#include <iostream>
#include <thread>
void hello()
{
std::cout << "Hello World\n";
}
//void hello( int howmany ) // overloading on threads not supported
//{
// while ( howmany-- ) {
// std::cout << "Hello World\n";
// }
//}
void hello2( int howmany )
{
while ( howmany-- ) {
std::cout << "Hello World\n";
}
}
int main()
{
std::thread t( hello );
t.join();
std::cout << "-----------\n";
t = std::thread( hello2, 10 ); // reuse "t"
t.join();
}