楼主:
kdok123 (小天)
2014-09-28 10:02:51//使用PluseEvent()函数
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <windows.h>
HANDLE g_hThreadEvent;
//快线程
unsigned int __stdcall FastThreadFun(void *pPM)
{
Sleep(10); //用这个来保证各线程调用等待函数的次序有一定的随机性
printf("%s 启动\n", (PSTR)pPM);
WaitForSingleObject(g_hThreadEvent, INFINITE);
printf("%s 等到事件被触发 顺利结束\n", (PSTR)pPM);
return 0;
}
//慢线程
unsigned int __stdcall SlowThreadFun(void *pPM)
{
Sleep(100);
printf("%s 启动\n", (PSTR)pPM);
WaitForSingleObject(g_hThreadEvent, INFINITE);
printf("%s 等到事件被触发 顺利结束\n", (PSTR)pPM);
return 0;
}
int main()
{
printf(" 使用PluseEvent()函数\n");
printf("