Sometimes it would have to wait a long time for lock to clear so moved it to a tryenter and skip if already locked

This commit is contained in:
Andy Adshead 2019-02-02 03:22:49 +00:00
commit 0fe8238d16

View file

@ -150,10 +150,11 @@ namespace Ryujinx.Profiler
{ {
_preserve = PerformanceCounter.ElapsedTicks; _preserve = PerformanceCounter.ElapsedTicks;
// Make sure to clear queue // Skip clearing queue if already clearing
lock (_timerQueueClearLock) if (Monitor.TryEnter(_timerQueueClearLock))
{ {
ClearTimerQueue(); ClearTimerQueue();
Monitor.Exit(_timerQueueClearLock);
} }
return Timers; return Timers;