#include <iostream>
#include <thread>
using std::cout;
using std::endl;
using std::thread;
void thread_function()
{
cout << "thread_function id: " << std::this_thread::get_id() << endl;
}
int main()
{
thread obj1(thread_function);
thread obj2(thread_function);
cout << "main() thread obj1 id: " << obj1.get_id() << endl;
cout << "main() thread obj2 id: " << obj2.get_id() << endl;
obj1.join();
obj2.join();
return 0;
}
/*
run:
thread_function id: 8948
main() thread obj1 id: 8948
main() thread obj2 id: 5320
thread_function id: 5320
*/