Untitled
unknown
c_cpp
11 days ago
453 B
4
Indexable
#include <iostream> #include <thread> void function1() { for (int i =0; i < 200;i++) std::cout<<"+"; } void function2(){ for (int i =0; i < 200; i++) std:: cout << "-"; } int main(){ std::thread t1(function1); std::thread t2(function2); std::thread::id t1_id =t1.get_id(); std::thread::id t2_id =t2.get_id (); std::cout <<"ID of thread 1:" <<t1_id <<std::endl; std::cout <<"ID of thread 1:" <<t2_id <<std::endl; t1.join(); t2.join(); return 0; }
Editor is loading...
Leave a Comment