R_API int r_th_kill(RThread *th, int force) { th->breaked = true; r_th_break(th); r_th_wait(th); #if HAVE_PTHREAD #ifdef __ANDROID__ pthread_kill (th->tid, 9); #else pthread_cancel (th->tid); #endif #elif __WINDOWS__ && !defined(__CYGWIN__) TerminateThread (th->tid, -1); #endif return 0; }
R_API bool r_th_kill(RThread *th, bool force) { if (!th || !th->tid) { return false; } th->breaked = true; r_th_break (th); r_th_wait (th); #if HAVE_PTHREAD #ifdef __ANDROID__ pthread_kill (th->tid, 9); #else pthread_cancel (th->tid); #endif #elif __WINDOWS__ TerminateThread (th->tid, -1); #endif return 0; }