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>
This commit is contained in:
Christophe de Dinechin 2024-01-16 18:51:32 +01:00
parent 887f4173b4
commit 1507f36dc5
4 changed files with 6 additions and 4 deletions

View file

@ -28,6 +28,7 @@
// ****************************************************************************
#include "sim-rpl.h"
#include "tests.h"
#include <dmcp.h>
extern int key_remaining();
@ -47,7 +48,7 @@ RPLThread::~RPLThread()
while (!isFinished())
{
if (key_remaining())
key_push(-1);
key_push(tests::EXIT_PGM);
}
}

View file

@ -98,7 +98,7 @@ MainWindow::~MainWindow()
// Destroy the main window
// ----------------------------------------------------------------------------
{
key_push(-1);
key_push(tests::EXIT_PGM);
}

View file

@ -372,7 +372,7 @@ extern "C" void program_main()
}
#if SIMULATOR
if (key == -1)
if (key == tests::EXIT_PGM)
{
cstring path = get_reset_state_file();
printf("Exit: saving state to %s\n", path);

View file

@ -179,7 +179,8 @@ struct tests
NOKEYS = 104, // Wait until keys buffer is empty
REFRESH = 105, // Wait until there is a screen refresh
KEYSYNC = 106,
KEYSYNC = 106, // Wait for other side to process keys
EXIT_PGM = 142, // Exiting program
};
protected: