Skip to content

Commit

Permalink
More code testing
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes committed Jun 11, 2024
1 parent 9cdeb7f commit 2051da8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions targets/win32/nanoCLR/targetPAL_Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,24 @@ static uint32_t SystemEvents;

bool Events_Initialize()
{
//Events_Initialize_Platform();
Events_Initialize_Platform();

//std::unique_lock scopeLock(EventsMutex);
std::unique_lock lock(EventsMutex);
SystemEvents = 0;
return TRUE;
}

bool Events_Uninitialize()
{
std::unique_lock scopeLock(EventsMutex);
std::unique_lock lock(EventsMutex);
SystemEvents = 0;
return TRUE;
}

void Events_Set(UINT32 Events)
{
{
std::unique_lock scopeLock(EventsMutex);
std::unique_lock lock(EventsMutex);
SystemEvents |= Events;
}

Expand All @@ -77,7 +77,7 @@ void Events_Set(UINT32 Events)

uint32_t Events_Get(UINT32 EventsOfInterest)
{
std::unique_lock scopeLock(EventsMutex);
std::unique_lock lock(EventsMutex);
auto retVal = SystemEvents & EventsOfInterest;
SystemEvents &= ~EventsOfInterest;
return retVal;
Expand All @@ -86,7 +86,7 @@ uint32_t Events_Get(UINT32 EventsOfInterest)
void Events_Clear(UINT32 Events)
{
{
std::unique_lock scopeLock(EventsMutex);
std::unique_lock lock(EventsMutex);
SystemEvents &= ~Events;
}
EventsConditionVar.notify_all();
Expand All @@ -102,7 +102,7 @@ uint32_t Events_WaitForEvents(uint32_t powerLevel, uint32_t wakeupSystemEvents,
{
(void)powerLevel;

std::unique_lock scopeLock(EventsMutex);
std::unique_lock lock(EventsMutex);

if (CLR_EE_DBG_IS(RebootPending) || CLR_EE_DBG_IS(ExitPending))
{
Expand All @@ -115,7 +115,7 @@ uint32_t Events_WaitForEvents(uint32_t powerLevel, uint32_t wakeupSystemEvents,
// check current condition before waiting as Condition var doesn't do that
if ((wakeupSystemEvents & SystemEvents) == 0)
{
timeout = !EventsConditionVar.wait_for(scopeLock, std::chrono::milliseconds(timeoutMilliseconds), [=]() {
timeout = !EventsConditionVar.wait_for(lock, std::chrono::milliseconds(timeoutMilliseconds), [=]() {
return (wakeupSystemEvents & SystemEvents) != 0;
});
}
Expand Down

0 comments on commit 2051da8

Please sign in to comment.