Added locking debug

This commit is contained in:
Jordan Sherer 2019-11-14 12:03:50 -05:00
parent 2f9e1201b3
commit cd1f961cac

View File

@ -1573,6 +1573,7 @@ void MainWindow::initDecoderSubprocess(){
} }
//Create .lock so jt9 will wait //Create .lock so jt9 will wait
if(JS8_DEBUG_DECODE) qDebug() << "decoder lock open";
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite); QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite);
QStringList js8_args { QStringList js8_args {
@ -3562,6 +3563,7 @@ void MainWindow::closeEvent(QCloseEvent * e)
mem_js8->detach(); mem_js8->detach();
QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")}; QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")};
quitFile.open(QIODevice::ReadWrite); quitFile.open(QIODevice::ReadWrite);
if(JS8_DEBUG_DECODE) qDebug() << "decoder lock close";
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove(); // Allow jt9 to terminate QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove(); // Allow jt9 to terminate
if(!proc_js8.isNull()){ if(!proc_js8.isNull()){
bool b=proc_js8->waitForFinished(1000); bool b=proc_js8->waitForFinished(1000);
@ -4015,7 +4017,7 @@ bool MainWindow::decode(){
int kZero = k0; int kZero = k0;
k0 = k; 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(k == kZero){
if(JS8_DEBUG_DECODE) qDebug() << "--> decoder stream has not advanced"; 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)); memcpy(to, from, qMin(mem_js8->size(), size));
} }
if(JS8_DEBUG_DECODE) qDebug() << "decoder lock close";
lock.remove(); // Allow decoder to start lock.remove(); // Allow decoder to start
} }
@ -4434,6 +4437,7 @@ void MainWindow::decodeBusy(bool b) //decodeBusy()
*/ */
void MainWindow::decodeDone () void MainWindow::decodeDone ()
{ {
if(JS8_DEBUG_DECODE) qDebug() << "decoder lock open";
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;
dec_data.params.nagain=0; dec_data.params.nagain=0;