1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-07 11:03:04 +00:00

Change ifdef structure.

This commit is contained in:
Calvin Rose
2025-05-18 13:20:19 -05:00
parent 92e91259c3
commit 8ac4eec370

View File

@@ -619,19 +619,16 @@ static void janet_timeout_stop(int sig_num) {
static void handle_timeout_worker(JanetTimeout to, int cancel) { static void handle_timeout_worker(JanetTimeout to, int cancel) {
if (!to.has_worker) return; if (!to.has_worker) return;
if (cancel) {
#ifdef JANET_WINDOWS #ifdef JANET_WINDOWS
QueueUserAPC(janet_timeout_stop, to.worker, 0); if (cancel) QueueUserAPC(janet_timeout_stop, to.worker, 0);
WaitForSingleObject(to.worker, INFINITE); WaitForSingleObject(to.worker, INFINITE);
CloseHandle(to.worker); CloseHandle(to.worker);
#else #else
#ifdef JANET_ANDROID #ifdef JANET_ANDROID
pthread_kill(to.worker, SIGUSR1); if (cancel) janet_assert(!pthread_kill(to.worker, SIGUSR1), "pthread_kill");
#else #else
int ret = pthread_cancel(to.worker); if (cancel) janet_assert(!pthread_cancel(to.worker), "pthread_cancel");
janet_assert(!ret, "pthread_cancel");
#endif #endif
}
void *res = NULL; void *res = NULL;
janet_assert(!pthread_join(to.worker, &res), "pthread_join"); janet_assert(!pthread_join(to.worker, &res), "pthread_join");
#endif #endif