예제 #1
0
파일: main.c 프로젝트: Lgggg/wangdaozuoye
void* handle1(void* arg){
	mtx.lock();
	std::cout<<"thread1 before add:"<<cnt<<std::endl;
	cnt++;
	std::cout<<"thread1 after add: "<<cnt<<std::endl;
	mtx.unlock();
	sleep(2);
}
예제 #2
0
파일: main.c 프로젝트: Lgggg/wangdaozuoye
void* handle2(void* arg){
	while(1){
	mtx.lock();
	std::cout<<"thread2 before add:"<<cnt<<std::endl;
	cnt++;
	std::cout<<"thread2 after add: "<<cnt<<std::endl;
	mtx.unlock();
	sleep(2);
	}
}