diff --git a/ChangeLog b/ChangeLog index c3251974..ecb0f7e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +L1VM - (1.4.3) + VM: main function now uses wait loop thread 1 on macOS only. + On macOS the main program will run in thread 0. This is needed to run the SDL module. + It can only be run from main program! + The other OS will run the VM bytecode in thread 1. + +-- Stefan Pietzonke Sun 09 Jan 2021 16:45 +0100 + L1VM - (1.4.2) JIT-compiler now sets a return code for run function and exits the program on error! diff --git a/include/global.h b/include/global.h index f78db508..ff0b1589 100644 --- a/include/global.h +++ b/include/global.h @@ -104,7 +104,7 @@ // info strings: #define COPYRIGHT_STR " (C) 2017-2022 Stefan Pietzonke" -#define VM_VERSION_STR "1.4.2" // version number +#define VM_VERSION_STR "1.4.3" // version number // no user defined definitions below this section! ============================ diff --git a/vm/main.c b/vm/main.c index 283423d1..da5a085f 100644 --- a/vm/main.c +++ b/vm/main.c @@ -3126,6 +3126,8 @@ int main (int ac, char *av[]) threaddata[new_cpu].sp_bottom_thread = threaddata[new_cpu].sp_bottom + (new_cpu * stack_size); threaddata[new_cpu].ep_startpos = 16; + // on macOS use wait loop thread, because the SDL module must be run from main thread!!! + #if __MACH__ new_cpu++; if (pthread_create (&id, NULL, (void *) run_main_loop_thread, (void *) new_cpu) != 0) { @@ -3137,6 +3139,14 @@ int main (int ac, char *av[]) // start main thread run (0); + #else + if (pthread_create (&id, NULL, (void *) run, (void *) new_cpu) != 0) + { + printf ("ERROR: can't start main thread!\n"); + cleanup (); + exit (1); + } + #endif pthread_join (id, NULL); cleanup ();