Skip to content

Commit

Permalink
More code tests
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes committed Jun 11, 2024
1 parent 70ab0c9 commit 7c929f5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion targets/netcore/nanoFramework.nanoCLR/nanoCLR_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void nanoCLR_Run(NANO_CLR_SETTINGS nanoClrSettings)
clrSettings.PerformGarbageCollection = nanoClrSettings.PerformGarbageCollection;
clrSettings.PerformHeapCompaction = nanoClrSettings.PerformHeapCompaction;

// ClrStartup(clrSettings);
ClrStartup(clrSettings);

#if !defined(BUILD_RTM)
CLR_Debug::Printf("Exiting.\r\n");
Expand Down
4 changes: 3 additions & 1 deletion targets/win32/Include/Win32TimerQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class Timer
{
auto err = ::GetLastError();
if (ERROR_IO_PENDING != err)
throw std::exception("Internal error: DeleteTimerQueueTimer() FAILED!", err);
{
CLR_Debug::Printf("Internal error: DeleteTimerQueueTimer() FAILED!\r\n");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion targets/win32/nanoCLR/Various.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void nanoHAL_Initialize(void)
HAL_CONTINUATION::InitializeList();
HAL_COMPLETION::InitializeList();

//Events_Initialize();
Events_Initialize();
}

void nanoHAL_Uninitialize(bool isPoweringDown)
Expand Down
27 changes: 18 additions & 9 deletions targets/win32/nanoCLR/targetPAL_Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void local_Events_SetBoolTimer_Callback()

bool Events_Initialize_Platform()
{
boolEventsTimer = NULL;
boolEventsTimer = nullptr;

return true;
}
Expand All @@ -29,9 +29,9 @@ void Events_SetBoolTimer(bool *timerCompleteFlag, uint32_t millisecondsFromNow)
NATIVE_PROFILE_PAL_EVENTS();

// we assume only 1 can be active, abort previous just in case
if (boolEventsTimer != NULL)
if (boolEventsTimer != nullptr)
{
delete boolEventsTimer.release();
boolEventsTimer.reset();
}

if (timerCompleteFlag)
Expand All @@ -51,30 +51,31 @@ static uint32_t SystemEvents;

bool Events_Initialize()
{
std::unique_lock<std::mutex> scopeLock(EventsMutex);
std::unique_lock scopeLock(EventsMutex);
SystemEvents = 0;
return TRUE;
}

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

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

EventsConditionVar.notify_all();
}

uint32_t Events_Get(UINT32 EventsOfInterest)
{
std::unique_lock<std::mutex> scopeLock(EventsMutex);
std::unique_lock scopeLock(EventsMutex);
auto retVal = SystemEvents & EventsOfInterest;
SystemEvents &= ~EventsOfInterest;
return retVal;
Expand All @@ -83,7 +84,7 @@ uint32_t Events_Get(UINT32 EventsOfInterest)
void Events_Clear(UINT32 Events)
{
{
std::unique_lock<std::mutex> scopeLock(EventsMutex);
std::unique_lock scopeLock(EventsMutex);
SystemEvents &= ~Events;
}
EventsConditionVar.notify_all();
Expand All @@ -97,7 +98,9 @@ uint32_t Events_MaskedRead(uint32_t Events)
// block this thread and wake up when at least one of the requested events is set or a timeout occurs...
uint32_t Events_WaitForEvents(uint32_t powerLevel, uint32_t wakeupSystemEvents, uint32_t timeoutMilliseconds)
{
std::unique_lock<std::mutex> scopeLock(EventsMutex);
(void)powerLevel;

std::unique_lock scopeLock(EventsMutex);

if (CLR_EE_DBG_IS(RebootPending) || CLR_EE_DBG_IS(ExitPending))
{
Expand Down Expand Up @@ -125,4 +128,10 @@ void Events_SetCallback(set_Event_Callback pfn, void *arg)

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

// nothing to release in this platform
}

0 comments on commit 7c929f5

Please sign in to comment.