先设置事件再等待该事件,结果是等到事件。也就是事件没有被关闭,设置了的事件一直有效
-
DWORD SetEventAndWaitSameEvent()
-
{
-
HANDLE event;
-
DWORD obj_ret;
-
event = CreateEvent(NULL, FALSE, FALSE, NULL);
-
SetEvent(event);
-
Sleep(1000);
-
obj_ret = WaitForSingleObject(event, INFINITE);
-
return obj_ret;
-
}
-
-
TEST(SetEventAndWaitSameEventTest, SameEvent)
-
{
-
EXPECT_EQ(WAIT_OBJECT_0, SetEventAndWaitSameEvent());
-
}
-
阅读(579) | 评论(0) | 转发(0) |