mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-11 14:30:08 +00:00
Get threaded tests unstuck and rename/shuffle some code
This commit is contained in:
parent
50cd4ac6fe
commit
cec638b959
@ -136,9 +136,6 @@
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
extern pthread_mutex_t interface_mutex;
|
||||
extern pthread_cond_t cpu_thread_cond;
|
||||
extern pthread_cond_t ui_thread_cond;
|
||||
extern bool caps_lock;
|
||||
|
||||
int c_mygetch(int block);
|
||||
|
@ -1170,7 +1170,7 @@ static int begin_cpu_stepping() {
|
||||
if ((err = pthread_cond_signal(&cpu_thread_cond))) {
|
||||
ERRLOG("pthread_cond_signal : %d", err);
|
||||
}
|
||||
if ((err = pthread_cond_wait(&ui_thread_cond, &interface_mutex))) {
|
||||
if ((err = pthread_cond_wait(&dbg_thread_cond, &interface_mutex))) {
|
||||
ERRLOG("pthread_cond_wait : %d", err);
|
||||
}
|
||||
|
||||
|
@ -70,16 +70,18 @@ static bool alt_speed_enabled = false;
|
||||
volatile uint8_t emul_reinitialize = 0;
|
||||
pthread_t cpu_thread_id = 0;
|
||||
pthread_mutex_t interface_mutex = { 0 };
|
||||
pthread_cond_t ui_thread_cond = PTHREAD_COND_INITIALIZER;
|
||||
pthread_cond_t dbg_thread_cond = PTHREAD_COND_INITIALIZER;
|
||||
pthread_cond_t cpu_thread_cond = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
__attribute__((constructor))
|
||||
static void _init_timing() {
|
||||
static void _init_timing(void) {
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
#if !TESTING
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
#endif
|
||||
pthread_mutex_init(&interface_mutex, &attr);
|
||||
}
|
||||
|
||||
@ -262,7 +264,7 @@ void *cpu_thread(void *dummyptr) {
|
||||
debugging_cycles -= cpu65_cycle_count;
|
||||
if (c_debugger_should_break() || (debugging_cycles <= 0)) {
|
||||
int err = 0;
|
||||
if ((err = pthread_cond_signal(&ui_thread_cond))) {
|
||||
if ((err = pthread_cond_signal(&dbg_thread_cond))) {
|
||||
ERRLOG("pthread_cond_signal : %d", err);
|
||||
}
|
||||
if ((err = pthread_cond_wait(&cpu_thread_cond, &interface_mutex))) {
|
||||
|
@ -52,6 +52,9 @@ extern double cpu_altscale_factor; // scale factor #2
|
||||
extern bool is_fullspeed; // emulation in full native speed?
|
||||
|
||||
extern pthread_t cpu_thread_id;
|
||||
extern pthread_mutex_t interface_mutex;
|
||||
extern pthread_cond_t cpu_thread_cond;
|
||||
extern pthread_cond_t dbg_thread_cond;
|
||||
|
||||
/*
|
||||
* calculate the difference between two timespec structures
|
||||
|
Loading…
x
Reference in New Issue
Block a user