// Sistemas Operacionais
// Cássio Pinheiro
// Tarefas em Paralelo
#include <iostream>
#include <thread>
using namespace std;
void thr1( void ) {
cout << "T1 ID " << this_thread::get_id() << endl;
cout << "Iniciando 1" << endl;
}
void thr2( void ) {
cout << "T2 ID " << this_thread::get_id() << endl;
cout << "Iniciando 2" << endl;
}
int main() {
cout << "Main ID " << this_thread::get_id() << endl;
thread t1( thr1 );
thread t2( thr2 );
t1.join();
t2.join();
return( 0 );
}
To embed this program on your website, copy the following code and paste it into your website's HTML: