@@ -73,7 +73,8 @@ int main(int argc, char *argv[]) {
73
73
if (err && err != ENOENT)
74
74
PANIC (" error while reading history file: %s\n " , std::strerror (err));
75
75
}
76
-
76
+
77
+ static std::atomic<bool > got_inp (false );
77
78
{
78
79
Emulator emulator (argv_map);
79
80
m_emu = &emulator;
@@ -82,19 +83,22 @@ int main(int argc, char *argv[]) {
82
83
83
84
// Used to signal to the console input thread when to stop.
84
85
static std::atomic<bool > running (true );
86
+ static std::atomic<int > inp_cnt (0 );
87
+ static char pr[500 ];
85
88
86
89
test_gui ();
87
90
std::thread console_input_thread ([&] {
88
91
while (1 ) {
89
92
char *console_input_c_str;
90
- bool got = false ;
93
+ got_inp = false ;
91
94
std::thread readline_thread ([&] {
92
- console_input_c_str = readline (" > " );
93
- got = true ;
95
+ sprintf (pr, " In [%d]: " , ++inp_cnt);
96
+ console_input_c_str = readline (pr);
97
+ got_inp = true ;
94
98
});
95
99
readline_thread.detach ();
96
100
97
- while (!got )
101
+ while (!got_inp )
98
102
if (!running)
99
103
return ;
100
104
@@ -194,7 +198,9 @@ int main(int argc, char *argv[]) {
194
198
console_input_thread.join ();
195
199
}
196
200
197
- std::cout << " \n Goodbye" << std::endl;
201
+ if (!got_inp)
202
+ std::cout << std::endl;
203
+ std::cout << " Goodbye" << std::endl;
198
204
199
205
IMG_Quit ();
200
206
SDL_Quit ();
0 commit comments