This commit is contained in:
pypy
2021-01-21 11:34:01 +09:00
parent 4e2f214119
commit 4caec1b732
2 changed files with 19 additions and 10 deletions

View File

@@ -62,21 +62,27 @@ namespace VRCX
internal void Exit() internal void Exit()
{ {
_timer.Change(-1, -1); lock (this)
_performanceCounter?.Dispose(); {
_timer.Change(-1, -1);
_performanceCounter?.Dispose();
}
} }
private void TimerCallback(object state) private void TimerCallback(object state)
{ {
try lock (this)
{ {
if (_performanceCounter != null) try
{
if (_performanceCounter != null)
{
CpuUsage = _performanceCounter.NextValue();
}
}
catch
{ {
CpuUsage = _performanceCounter.NextValue();
} }
}
catch
{
} }
} }
} }

View File

@@ -37,8 +37,11 @@ namespace VRCX
internal void Exit() internal void Exit()
{ {
m_Timer.Change(-1, -1); lock (this)
m_Client?.Dispose(); {
m_Timer.Change(-1, -1);
m_Client?.Dispose();
}
} }
private void TimerCallback(object state) private void TimerCallback(object state)