#include "stdafx.h"#includeint main(){ HANDLE m_hEvent = CreateEvent(NULL, FALSE, FALSE, TEXT("event_test")); ResetEvent(m_hEvent); while (1) { SetEvent(m_hEvent); Sleep(3000); } CloseHandle(m_hEvent); return 0;}
#include "stdafx.h"#includeint main(){ HANDLE m_hEvent = OpenEvent(EVENT_ALL_ACCESS, NULL, TEXT("event_test")); while (1) { WaitForSingleObject(m_hEvent, INFINITE); printf("11111111111111\n"); ResetEvent(m_hEvent); } return 0;}