Browse Source

Fix a possible race condition

tags/v1.9.12
falkTX 6 years ago
parent
commit
c59a1eb97a
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      source/backend/plugin/CarlaPluginInternal.cpp

+ 4
- 3
source/backend/plugin/CarlaPluginInternal.cpp View File

@@ -528,10 +528,11 @@ void CarlaPlugin::ProtectedData::PostRtEvents::appendRT(const PluginPostRtEvent&


void CarlaPlugin::ProtectedData::PostRtEvents::trySplice() noexcept void CarlaPlugin::ProtectedData::PostRtEvents::trySplice() noexcept
{ {
if (dataMutex.tryLock())
const CarlaMutexTryLocker cmtl(dataPendingMutex);

if (cmtl.wasLocked() && dataPendingRT.count() > 0 && dataMutex.tryLock())
{ {
if (dataPendingRT.count() > 0)
dataPendingRT.moveTo(data, true);
dataPendingRT.moveTo(data, true);
dataMutex.unlock(); dataMutex.unlock();
} }
} }


Loading…
Cancel
Save