Unify and brace thread creation with TEMP_FAILURE_RETRY()

This commit is contained in:
Aaron Culliney 2019-02-24 09:24:12 -08:00
parent d90e12b5dc
commit f038ef0346
6 changed files with 10 additions and 16 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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

View File

@ -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);

View File

@ -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) {

View File

@ -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);
}
}