forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.cpp
More file actions
20 lines (18 loc) · 887 Bytes
/
Event.cpp
File metadata and controls
20 lines (18 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "CommonCommonPch.h"
#include "Common\Event.h"
Event::Event(const bool autoReset, const bool signaled) : handle(CreateEvent(0, !autoReset, signaled, 0))
{
if(!handle)
Js::Throw::OutOfMemory();
}
bool Event::Wait(const unsigned int milliseconds) const
{
const unsigned int result = WaitForSingleObject(handle, milliseconds);
if(!(result == WAIT_OBJECT_0 || (result == WAIT_TIMEOUT && milliseconds != INFINITE)))
Js::Throw::FatalInternalError();
return result == WAIT_OBJECT_0;
}