View difference between Paste ID: KBAirDn4 and V4ZURi9m
SHOW: | | - or go back to the newest paste.
1
#include <iostream>
2
#include <thread>
3
4
using namespace std;
5
6-
void count (int in) {
6+
void count (int in = 1) {
7
		for (int a = 0, b = 0; a < 99999999; ++a) b = a+a*a+a*a-(a+a*a);
8
	cout << in << endl;
9
}
10
11-
	for (int a = 0; a < 100000; ++a); //I know this is probably frowned upon
11+
12-
	cout << "One" << endl;
12+
	for (int a = 0, b = 0; a < 9999999; ++a) b = a+a*a+a*a-(a+a*a); //I know this is probably frowned upon
13
	cout << "\t\tOne" << endl;
14
}
15
16
int main() {
17-
	for (int i = 0; i < 1000; ++i) {
17+
	thread t1;
18-
	thread countt (count , i); countt.detach ();
18+
	thread t2;
19-
	thread onet (one); onet.detach ();
19+
20
	for (int a = 0; a < 100; ++a) {
21
		t1 = thread (count, a);
22
		t2 = thread (one);
23
		t1.join (); t2.join ();
24
	}
25
	
26
	cout << "\nDone\n";
27
}