LimeSDR output: suspend/resume buddies threads before/after start/stop

This commit is contained in:
f4exb 2017-09-30 20:25:20 +02:00
parent d524378d8e
commit dcfdffaf49
1 changed files with 13 additions and 0 deletions

View File

@ -259,6 +259,9 @@ void LimeSDROutput::closeDevice()
bool LimeSDROutput::acquireChannel() bool LimeSDROutput::acquireChannel()
{ {
suspendRxBuddies();
suspendTxBuddies();
// acquire the channel // acquire the channel
if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_TX, m_deviceShared.m_channel, true) != 0) if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_TX, m_deviceShared.m_channel, true) != 0)
@ -282,6 +285,8 @@ bool LimeSDROutput::acquireChannel()
if (LMS_SetupStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId) != 0) if (LMS_SetupStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId) != 0)
{ {
qCritical("LimeSDROutput::acquireChannel: cannot setup the stream on Tx channel %d", m_deviceShared.m_channel); qCritical("LimeSDROutput::acquireChannel: cannot setup the stream on Tx channel %d", m_deviceShared.m_channel);
resumeTxBuddies();
resumeRxBuddies();
return false; return false;
} }
else else
@ -290,11 +295,17 @@ bool LimeSDROutput::acquireChannel()
} }
m_channelAcquired = true; m_channelAcquired = true;
resumeTxBuddies();
resumeRxBuddies();
return true; return true;
} }
void LimeSDROutput::releaseChannel() void LimeSDROutput::releaseChannel()
{ {
suspendRxBuddies();
suspendTxBuddies();
// destroy the stream // destroy the stream
LMS_DestroyStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId); LMS_DestroyStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId);
m_streamId.handle = 0; m_streamId.handle = 0;
@ -307,6 +318,8 @@ void LimeSDROutput::releaseChannel()
} }
m_channelAcquired = false; m_channelAcquired = false;
resumeTxBuddies();
resumeRxBuddies();
} }
bool LimeSDROutput::start() bool LimeSDROutput::start()