#include <iostream>
#include <boost/thread.hpp>
#include <boost/chrono.hpp>

using namespace boost;
using namespace std;

void mw(int tid, int *p) {
	cout << "Hello from thread : " << this_thread::get_id() <<":" << tid << endl;
	for(int i=0; i<10; i++){
		cout << "thread" << tid  <<" p:[" << i << "]=" << *p << endl;
		p++;
	}
}



void mw2(int tid , int *p){
	cout << "Hello from thread: " << this_thread::get_id() << ":" << tid << endl;
	for(int i=0; i<10; i++) {
		cout <<"Thread " << tid<< "|" << " p:[" << i << "]=" << p[i] << endl;
		p++;
	}
}
int main(void) {
	int *a = new int[10];
	int count=1;
	for(int i=0; i<10; i++)
		a[i]=i;
	thread *t1 = new thread(mw,count,a);
	count++;
	thread *t2 = new thread(mw2,count,a);

//	/wait
	//if we do not join a thread, we dispatch them.
	//they all go on the same core (preferable) bc they are treated as light processes
	//the core takess processes and threads from the same queues
	
	t1->join();
	t2->join();
}
