Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <thread>
- using namespace std;
- void count (int in) {
- cout << in << endl;
- }
- void one () {
- for (int a = 0; a < 100000; ++a); //I know this is probably frowned upon
- cout << "One" << endl;
- }
- int main() {
- for (int i = 0; i < 1000; ++i) {
- thread countt (count , i); countt.detach ();
- thread onet (one); onet.detach ();
- }
- cout << "\nDone\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment