mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-24 02:33:19 +00:00
Unify and brace thread creation with TEMP_FAILURE_RETRY()
This commit is contained in:
parent
d90e12b5dc
commit
f038ef0346
@ -1712,11 +1712,8 @@ static bool MB_DSInit()
|
||||
|
||||
#if 1 // APPLE2IX
|
||||
{
|
||||
int err = 0;
|
||||
if ((err = pthread_create(&g_hThread, NULL, SSI263Thread, NULL)))
|
||||
{
|
||||
LOG("SSI263Thread");
|
||||
}
|
||||
int err = TEMP_FAILURE_RETRY(pthread_create(&g_hThread, NULL, SSI263Thread, NULL));
|
||||
assert(!err);
|
||||
|
||||
// assuming time critical ...
|
||||
# if defined(__APPLE__) || defined(ANDROID)
|
||||
|
@ -1565,7 +1565,8 @@ void c_interface_begin(int current_key)
|
||||
pthread_mutex_lock(&classic_interface_lock);
|
||||
interface_thread_id=1; // interface thread starting ...
|
||||
interface_key.current_key = current_key;
|
||||
pthread_create(&interface_thread_id, NULL, (void *)&interface_thread, &interface_key);
|
||||
int err = TEMP_FAILURE_RETRY(pthread_create(&interface_thread_id, NULL, (void *)&interface_thread, &interface_key));
|
||||
assert(!err);
|
||||
pthread_detach(interface_thread_id);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,8 @@ void c_joystick_reset(void)
|
||||
run_args.joy_button1 = 0x0;
|
||||
#else
|
||||
pthread_t pid;
|
||||
pthread_create(&pid, NULL, (void *)&_joystick_resetDelayed, (void *)NULL);
|
||||
int err = TEMP_FAILURE_RETRY(pthread_create(&pid, NULL, (void *)&_joystick_resetDelayed, (void *)NULL));
|
||||
assert(!err);
|
||||
pthread_detach(pid);
|
||||
#endif
|
||||
|
||||
|
@ -174,10 +174,7 @@ static void _trace_init(void) {
|
||||
|
||||
assert(systrace_thread_id == 0);
|
||||
int err = TEMP_FAILURE_RETRY(pthread_create(&systrace_thread_id, NULL, (void *)&systrace_thread, (void *)NULL));
|
||||
if (err) {
|
||||
LOG("pthread_create for systrace writer failed!");
|
||||
assert(false);
|
||||
}
|
||||
assert(!err);
|
||||
|
||||
while (!systrace_thread_initialized) {
|
||||
usleep(FILE_WRITER_USLEEP);
|
||||
|
@ -497,10 +497,7 @@ void timing_startCPU(void) {
|
||||
cpu_shutting_down = false;
|
||||
assert(cpu_thread_id == 0);
|
||||
int err = TEMP_FAILURE_RETRY(pthread_create(&cpu_thread_id, NULL, (void *)&cpu_thread, (void *)NULL));
|
||||
if (err) {
|
||||
LOG("pthread_create failed!");
|
||||
assert(false);
|
||||
}
|
||||
assert(!err);
|
||||
}
|
||||
|
||||
void timing_stopCPU(void) {
|
||||
|
@ -194,7 +194,8 @@ static void *_button_tap_delayed_thread(void *dummyptr) {
|
||||
static void touchjoy_setup(void (*buttonDrawCallback)(char newChar)) {
|
||||
joys.buttonDrawCallback = buttonDrawCallback;
|
||||
if (joys.tapDelayThreadId == 0) {
|
||||
pthread_create(&joys.tapDelayThreadId, NULL, (void *)&_button_tap_delayed_thread, (void *)NULL);
|
||||
int err = TEMP_FAILURE_RETRY(pthread_create(&joys.tapDelayThreadId, NULL, (void *)&_button_tap_delayed_thread, (void *)NULL));
|
||||
assert(!err);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user