Further mutex for decode done to avoid race conditions across threads
This commit is contained in:
parent
70bc0e7784
commit
7bc78d3496
@ -4076,6 +4076,8 @@ bool MainWindow::decode(qint32 k){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// critical section (modifying dec_data)
|
||||||
|
|
||||||
qint32 submode = -1;
|
qint32 submode = -1;
|
||||||
if(!decodeProcessQueue(&submode)){
|
if(!decodeProcessQueue(&submode)){
|
||||||
return false;
|
return false;
|
||||||
@ -4211,6 +4213,9 @@ bool MainWindow::decodeEnqueueReady(qint32 k, qint32 k0){
|
|||||||
* @return true if the decoder is ready to be run, false otherwise
|
* @return true if the decoder is ready to be run, false otherwise
|
||||||
*/
|
*/
|
||||||
bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
|
bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
|
||||||
|
// critical section
|
||||||
|
QMutexLocker mutex(m_detector->getMutex());
|
||||||
|
|
||||||
if(m_decoderBusy){
|
if(m_decoderBusy){
|
||||||
int seconds = m_decoderBusyStartTime.secsTo(DriftingDateTime::currentDateTimeUtc());
|
int seconds = m_decoderBusyStartTime.secsTo(DriftingDateTime::currentDateTimeUtc());
|
||||||
if(seconds > 60){
|
if(seconds > 60){
|
||||||
@ -4481,6 +4486,9 @@ void MainWindow::decodeBusy(bool b) //decodeBusy()
|
|||||||
*/
|
*/
|
||||||
void MainWindow::decodeDone ()
|
void MainWindow::decodeDone ()
|
||||||
{
|
{
|
||||||
|
// critical section
|
||||||
|
QMutexLocker mutex(m_detector->getMutex());
|
||||||
|
|
||||||
if(JS8_DEBUG_DECODE) qDebug() << "decoder lock create";
|
if(JS8_DEBUG_DECODE) qDebug() << "decoder lock create";
|
||||||
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite);
|
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite);
|
||||||
dec_data.params.newdat=0;
|
dec_data.params.newdat=0;
|
||||||
@ -4490,6 +4498,7 @@ void MainWindow::decodeDone ()
|
|||||||
m_RxLog=0;
|
m_RxLog=0;
|
||||||
m_blankLine=true;
|
m_blankLine=true;
|
||||||
m_messageDupeCache.clear();
|
m_messageDupeCache.clear();
|
||||||
|
|
||||||
decodeBusy(false);
|
decodeBusy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4650,7 +4659,7 @@ QList<int> generateOffsets(int minOffset, int maxOffset){
|
|||||||
|
|
||||||
void MainWindow::readFromStdout(QProcess * proc) //readFromStdout
|
void MainWindow::readFromStdout(QProcess * proc) //readFromStdout
|
||||||
{
|
{
|
||||||
if(!proc || proc->state() != QProcess::Running){
|
if(!proc || proc->state() == QProcess::NotRunning){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user