Skip to content

Commit 25d2c56

Browse files
committed
Clean up
1 parent f2ea85c commit 25d2c56

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

Source/PluginProcessor.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,31 +1437,32 @@ void PluginProcessor::runBackupLoop()
14371437
backupRunLoopInterval *= 2; // Increase the interval so we get correct timing
14381438
}
14391439

1440-
if(backupLoopLock.tryEnter()) {
1441-
if(isProcessingAudio)
1442-
{
1443-
backupRunLoop.stopTimer();
1444-
backupLoopLock.exit();
1440+
{
1441+
ScopedTryLock const scopedTimerLock(backupLoopLock);
1442+
if(scopedTimerLock.isLocked()) {
1443+
if(isProcessingAudio)
1444+
{
1445+
backupRunLoop.stopTimer();
1446+
return;
1447+
}
1448+
1449+
backupRunLoop.startTimer(backupRunLoopInterval);
1450+
}
1451+
else {
14451452
return;
14461453
}
1447-
1448-
backupRunLoop.startTimer(backupRunLoopInterval);
1449-
backupLoopLock.exit();
1450-
}
1451-
else {
1452-
return;
14531454
}
14541455

14551456
setThis();
1456-
if(audioLock.tryEnter()) {
1457+
ScopedTryLock const scopedAudioLock(backupLoopLock);
1458+
if(scopedAudioLock.isLocked()) {
14571459
sendMessagesFromQueue();
14581460
sendParameters();
14591461
for(int i = 0; i < blocksToProcess; i++) {
14601462
if(isProcessingAudio) break;
14611463
sys_pollgui();
14621464
sched_tick_nodsp();
14631465
}
1464-
audioLock.exit();
14651466
}
14661467
}
14671468

0 commit comments

Comments
 (0)