static DWORD WINAPI _r_th_launcher(void *_th) { #else static void *_r_th_launcher(void *_th) { #endif int ret; RThread *th = _th; th->ready = true; #if __UNIX__ if (th->delay > 0) { sleep (th->delay); } else if (th->delay < 0) { r_th_lock_wait (th->lock); } #else if (th->delay < 0) { r_th_lock_wait (th->lock); } #endif do { // CID 1378280: API usage errors (LOCK) // "r_th_lock_leave" unlocks "th->lock->lock" while it is unlocked. r_th_lock_leave (th->lock); th->running = true; ret = th->fun (th); th->running = false; r_th_lock_enter (th->lock); } while (ret); #if HAVE_PTHREAD pthread_exit (&ret); #endif return 0; }
static DWORD WINAPI _r_th_launcher(void *_th) { #else static void *_r_th_launcher(void *_th) { #endif int ret; RThread *th = _th; th->ready = true; #if __UNIX__ if (th->delay > 0) { sleep (th->delay); } else if (th->delay < 0) { r_th_lock_wait (th->lock); } #else if (th->delay < 0) { r_th_lock_wait (th->lock); } #endif r_th_lock_enter (th->lock); do { r_th_lock_leave (th->lock); th->running = true; ret = th->fun (th); th->running = false; r_th_lock_enter (th->lock); } while (ret); #if HAVE_PTHREAD pthread_exit (&ret); #endif return 0; }