#include <boost/thread.hpp>
#include <boost/thread/barrier.hpp>
#include <iostream>
using namespace std;
using namespace boost;
boost::barrier sync_point(3);

void worker(int id){
	cout<<"thread: "<<id<<"before barrier "<<endl;
	this_thread::sleep_for(boost::chrono::milliseconds(1000));
	cout<<"Thread: "<<id<<"waiting at barrier "<<endl;
	sync_point.wait();
	cout <<"Thread: "<<id<<"Passed barrier "<<endl;
}

int main() {
	thread t1(worker, 1);
	thread t2(worker,2);
	thread t3(worker,3);
	t1.join();
	t2.join();
	t3.join();
}
