From cd1f961caca075812f57b069579b5599dbc82ae1 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 14 Nov 2019 12:03:50 -0500 Subject: [PATCH] Added locking debug --- mainwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 45fc9df..6e0abb9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1573,6 +1573,7 @@ void MainWindow::initDecoderSubprocess(){ } //Create .lock so jt9 will wait + if(JS8_DEBUG_DECODE) qDebug() << "decoder lock open"; QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite); QStringList js8_args { @@ -3562,6 +3563,7 @@ void MainWindow::closeEvent(QCloseEvent * e) mem_js8->detach(); QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")}; quitFile.open(QIODevice::ReadWrite); + if(JS8_DEBUG_DECODE) qDebug() << "decoder lock close"; QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove(); // Allow jt9 to terminate if(!proc_js8.isNull()){ bool b=proc_js8->waitForFinished(1000); @@ -4015,7 +4017,7 @@ bool MainWindow::decode(){ int kZero = k0; k0 = k; - if(JS8_DEBUG_DECODE) qDebug() << "decoder checking if ready..." << "k" << k << "k0" << kZero; + if(JS8_DEBUG_DECODE) qDebug() << "decoder checking if ready..." << "k" << k << "k0" << kZero << "busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists()); if(k == kZero){ if(JS8_DEBUG_DECODE) qDebug() << "--> decoder stream has not advanced"; @@ -4406,6 +4408,7 @@ void MainWindow::decodeStart(){ memcpy(to, from, qMin(mem_js8->size(), size)); } + if(JS8_DEBUG_DECODE) qDebug() << "decoder lock close"; lock.remove(); // Allow decoder to start } @@ -4434,6 +4437,7 @@ void MainWindow::decodeBusy(bool b) //decodeBusy() */ void MainWindow::decodeDone () { + if(JS8_DEBUG_DECODE) qDebug() << "decoder lock open"; QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite); dec_data.params.newdat=0; dec_data.params.nagain=0;