예제 #1
0
void reader(rw_data &d){
	int x;
	for(int i=0;i < 10; ++i){
		this_thread::sleep(posix_time::milliseconds(5));
		d.read(&x);
		mutex::scoped_lock lock(io_mu);
		cout <<"#" << this_thread::get_id() << ", reader:" << x << endl;
	}
}
예제 #2
0
void reader(rw_data& d)
{
	using namespace boost;
	int x;
	for(int i = 0; i < 10; i++)
	{
		this_thread::sleep(posix_time::millisec(5));
		d.read(&x);
		mutex::scoped_lock lock(io_mutex);
		cout << "reader: " << x << endl;
	}
}