mirror of
https://github.com/janet-lang/janet
synced 2025-09-11 23:36:07 +00:00
Change ifdef structure.
This commit is contained in:
@@ -619,19 +619,16 @@ static void janet_timeout_stop(int sig_num) {
|
||||
|
||||
static void handle_timeout_worker(JanetTimeout to, int cancel) {
|
||||
if (!to.has_worker) return;
|
||||
if (cancel) {
|
||||
#ifdef JANET_WINDOWS
|
||||
QueueUserAPC(janet_timeout_stop, to.worker, 0);
|
||||
if (cancel) QueueUserAPC(janet_timeout_stop, to.worker, 0);
|
||||
WaitForSingleObject(to.worker, INFINITE);
|
||||
CloseHandle(to.worker);
|
||||
#else
|
||||
#ifdef JANET_ANDROID
|
||||
pthread_kill(to.worker, SIGUSR1);
|
||||
if (cancel) janet_assert(!pthread_kill(to.worker, SIGUSR1), "pthread_kill");
|
||||
#else
|
||||
int ret = pthread_cancel(to.worker);
|
||||
janet_assert(!ret, "pthread_cancel");
|
||||
if (cancel) janet_assert(!pthread_cancel(to.worker), "pthread_cancel");
|
||||
#endif
|
||||
}
|
||||
void *res = NULL;
|
||||
janet_assert(!pthread_join(to.worker, &res), "pthread_join");
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user