摘要:
用Event实现线程同步#include <windows.h>#include <iostream.h>//1.线程函数声明DWORD WINAPI Fun1Proc(LPVOID lpParameter);DWORD WINAPI Fun2Proc(LPVOID lpParameter);int tickets=100;HANDLE g_hEvent; //在3.中,保存事件对象void main(){//2.创建线程HANDLE hThread1;HANDLE hThread2;hThread1=CreateThread(NULL,0,Fun1Proc,NULL, 阅读全文