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 2051da8 commit e09dd29
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions targets/win32/nanoCLR/targetPAL_Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "stdafx.h"
#include <Win32TimerQueue.h>

static std::unique_ptr<Microsoft::Win32::Timer> boolEventsTimer;
static bool *saveTimerCompleteFlag = 0;
static std::unique_ptr<Microsoft::Win32::Timer> boolEventsTimer = nullptr;
static bool *saveTimerCompleteFlag = nullptr;

void local_Events_SetBoolTimer_Callback()
{
Expand Down Expand Up @@ -53,22 +53,27 @@ bool Events_Initialize()
{
Events_Initialize_Platform();

std::unique_lock lock(EventsMutex);
std::lock_guard<std::mutex> lock(EventsMutex);

SystemEvents = 0;

return TRUE;
}

bool Events_Uninitialize()
{
std::unique_lock lock(EventsMutex);
SystemEvents = 0;
{
const std::lock_guard<std::mutex> lock(EventsMutex);
SystemEvents = 0;
}

return TRUE;
}

void Events_Set(UINT32 Events)
{
{
std::unique_lock lock(EventsMutex);
const std::lock_guard<std::mutex> lock(EventsMutex);
SystemEvents |= Events;
}

Expand All @@ -77,18 +82,20 @@ void Events_Set(UINT32 Events)

uint32_t Events_Get(UINT32 EventsOfInterest)
{
std::unique_lock lock(EventsMutex);
const std::lock_guard<std::mutex> lock(EventsMutex);
auto retVal = SystemEvents & EventsOfInterest;
SystemEvents &= ~EventsOfInterest;

return retVal;
}

void Events_Clear(UINT32 Events)
{
{
std::unique_lock lock(EventsMutex);
const std::lock_guard<std::mutex> lock(EventsMutex);
SystemEvents &= ~Events;
}

EventsConditionVar.notify_all();
}

Expand All @@ -102,7 +109,7 @@ uint32_t Events_WaitForEvents(uint32_t powerLevel, uint32_t wakeupSystemEvents,
{
(void)powerLevel;

std::unique_lock lock(EventsMutex);
std::unique_lock<std::mutex> lock(EventsMutex);

if (CLR_EE_DBG_IS(RebootPending) || CLR_EE_DBG_IS(ExitPending))
{
Expand All @@ -125,15 +132,18 @@ uint32_t Events_WaitForEvents(uint32_t powerLevel, uint32_t wakeupSystemEvents,

void Events_SetCallback(set_Event_Callback pfn, void *arg)
{
(void)pfn;
(void)arg;

_ASSERTE(FALSE);
}

void FreeManagedEvent(uint8_t category, uint8_t subCategory, uint16_t data1, uint32_t data2)
{
(void)category;
(void)subCategory;
(void)data1;
(void)data2;
(void)category;
(void)subCategory;
(void)data1;
(void)data2;

// nothing to release in this platform
}

0 comments on commit e09dd29

Please sign in to comment.