From a10f56446a24ad01a5330c96b473d928206c3db5 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Sun, 8 Oct 2023 17:07:24 +0200 Subject: [PATCH] CPU simulation in another thread --- src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index b275777..eb7b64e 100644 --- a/src/main.c +++ b/src/main.c @@ -27,8 +27,12 @@ int main(int argc, char** argv) gdbstub_wait_for_connection(); } - // CPU simulation - cpu_loop(cpu0); + // CPU simulation : create cpu0 thread + pthread_t cpu0_thread; + pthread_create(&cpu0_thread, 0, (void*) cpu_loop, cpu0); + + // Wait for the simulation to end + pthread_join(cpu0_thread, 0); return 0; }