Skip to content

Commit 334d4e0

Browse files
josesimoesaromaa
authored andcommitted
Fix virtual device app exit (#2485)
***NO_CI***
1 parent 5d4b9c0 commit 334d4e0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/CLR/Debugger/Debugger.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,11 @@ bool CLR_DBG_Debugger::Debugging_Execution_ChangeConditions(WP_Message *msg)
13931393
{
13941394
// update conditions
13951395
g_CLR_RT_ExecutionEngine.m_iDebugger_Conditions = newConditions;
1396+
1397+
#ifdef VIRTTUAL_DEVICE
1398+
// fire event with update on debugger activity
1399+
::Events_Set(SYSTEM_EVENT_FLAG_DEBUGGER_ACTIVITY);
1400+
#endif // VIRTTUAL_DEVICE
13961401
}
13971402

13981403
return true;

targets/win32/nanoCLR/targetPAL_Events.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,22 @@ uint32_t Events_WaitForEvents(uint32_t powerLevel, uint32_t wakeupSystemEvents,
9999
{
100100
std::unique_lock<std::mutex> scopeLock(EventsMutex);
101101

102+
if (CLR_EE_DBG_IS(RebootPending) || CLR_EE_DBG_IS(ExitPending))
103+
{
104+
// there is a reboot or program exit condition pending, no need to wait for anything
105+
return 0;
106+
}
107+
102108
bool timeout = false;
109+
103110
// check current condition before waiting as Condition var doesn't do that
104111
if ((wakeupSystemEvents & SystemEvents) == 0)
105112
{
106113
timeout = !EventsConditionVar.wait_for(scopeLock, std::chrono::milliseconds(timeoutMilliseconds), [=]() {
107114
return (wakeupSystemEvents & SystemEvents) != 0;
108115
});
109116
}
117+
110118
return timeout ? 0 : SystemEvents & wakeupSystemEvents;
111119
}
112120

0 commit comments

Comments
 (0)