Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 37856011c609
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4afdc86d0cb8
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 11, 2020

  1. LeCroyOscilloscope: don't lock m_mutex during IsChannelEnabled() unti…

    …l we're sure that we actually need to send a command to the hardware
    azonenberg committed May 11, 2020
    Copy the full SHA
    4afdc86 View commit details
Showing with 7 additions and 4 deletions.
  1. +7 −4 scopehal/LeCroyOscilloscope.cpp
11 changes: 7 additions & 4 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -400,14 +400,17 @@ bool LeCroyOscilloscope::IsChannelEnabled(size_t i)
if(i == m_extTrigChannel->GetIndex())
return false;

//Early-out if status is in cache
{
lock_guard<recursive_mutex> lock2(m_cacheMutex);
if(m_channelsEnabled.find(i) != m_channelsEnabled.end())
return m_channelsEnabled[i];
}

//Need to lock the main mutex first to prevent deadlocks
lock_guard<recursive_mutex> lock(m_mutex);
lock_guard<recursive_mutex> lock2(m_cacheMutex);

//Check cache
if(m_channelsEnabled.find(i) != m_channelsEnabled.end())
return m_channelsEnabled[i];

//Analog
if(i < m_analogChannelCount)
{