db48x/sim/sim-rpl.cpp
Christophe de Dinechin 1507f36dc5 tests: Replace magic constant -1 with EXIT_PGM
We use `-1` to mark the termination of the RPL thread and request the
state to be saved on disk.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-01-18 22:48:16 +01:00

62 lines
1.9 KiB
C++

// ****************************************************************************
// sim-rpl.cpp DB48X project
// ****************************************************************************
//
// File Description:
//
// The thread running the simulator
//
//
//
//
//
//
//
//
// ****************************************************************************
// (C) 2022 Christophe de Dinechin <christophe@dinechin.org>
// This software is licensed under the terms outlined in LICENSE.txt
// ****************************************************************************
// This file is part of DB48X.
//
// DB48X is free software: you can redistribute it and/or modify
// it under the terms outlined in the LICENSE.txt file
//
// DB48X is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// ****************************************************************************
#include "sim-rpl.h"
#include "tests.h"
#include <dmcp.h>
extern int key_remaining();
RPLThread::RPLThread(QObject *parent) : QThread(parent)
// ----------------------------------------------------------------------------
// Constructor
// ----------------------------------------------------------------------------
{}
RPLThread::~RPLThread()
// ----------------------------------------------------------------------------
// Destructor
// ----------------------------------------------------------------------------
{
while (!isFinished())
{
if (key_remaining())
key_push(tests::EXIT_PGM);
}
}
void RPLThread::run()
// ----------------------------------------------------------------------------
// Thread entry point
// ----------------------------------------------------------------------------
{
program_main();
}