1 #ifndef EMU_THREAD_H 2 #define EMU_THREAD_H 3 4 #include "common.h" 5 6 /* gpSP doesn't have a top-level main loop that we can use, so instead we run it in its own thread 7 * and switch between it and the main thread. Calling this function will block the current thread 8 * and unblock the other. 9 * 10 * This function can be called from either the main or the emulation thread. 11 */ 12 void retro_switch_thread(void); 13 14 /* Initialize the emulation thread and any related resources. 15 * 16 * Only call this function from the main thread. 17 */ 18 bool retro_init_emu_thread(bool dynarec, u32 cycles); 19 20 /* Destroy the emulation thread and any related resources. Only call this after the emulation thread 21 * has finished (or canceled) and joined. 22 * 23 * Only call this function from the main thread. 24 */ 25 void retro_deinit_emu_thread(void); 26 27 /* Returns true if the emulation thread was initialized successfully. 28 * 29 * This function can be called from either the main or the emulation thread. 30 */ 31 bool retro_is_emu_thread_initialized(void); 32 33 /* Join the emulation thread. The thread must have exited naturally or been canceled. 34 * 35 * Only call this function from the main thread. 36 */ 37 void retro_join_emu_thread(void); 38 39 /* Cancel the emulation thread. 40 * 41 * Only call this function from the main thread. 42 */ 43 void retro_cancel_emu_thread(void); 44 45 /* Returns true if the emulation thread has exited naturally. 46 * 47 * This function can be called from either the main or the emulation thread. 48 */ 49 bool retro_emu_thread_exited(void); 50 51 #endif 52