前列腺钙化
前列腺钙化的我,如何拯救输卵管堵塞的你。

HANDLE hSemaphore;
cout<<1<<endl;

hSemaphore = CreateSemaphore( NULL, 0, 10000, NULL);  //初始 0个资源

ReleaseSemaphore(hSemaphore, 1, NULL); //+1
ReleaseSemaphore(hSemaphore, 1, NULL); //+1

DWORD dwWaitResult = WaitForSingleObject(hSemaphore, INFINITE);  //等待到 -1
cout<<2<<endl;
WaitForSingleObject(hSemaphore, INFINITE); //等待到 -1
cout<<3<<endl;

WaitForSingleObject(hSemaphore, INFINITE); //此时资源为0,阻塞在这里等待资源增加才能继续
cout<<4<<endl;

posted on 2016-12-12 12:25  龙城狂拽酷炫霸  阅读(728)  评论(0编辑  收藏  举报