From ad8f3481309bf4f0eeb5acbc0c4c8e38fd07fa3b Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" <christian@zuckschwerdt.org> Date: Sat, 17 Dec 2022 12:38:17 +0100 Subject: [PATCH] minor: Fix pthread_cancel compat --- include/compat_pthread.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/compat_pthread.h b/include/compat_pthread.h index 495fb03b..004439b3 100644 --- a/include/compat_pthread.h +++ b/include/compat_pthread.h @@ -15,10 +15,10 @@ #define THREAD_RETURN unsigned int typedef HANDLE pthread_t; #define pthread_create(tp, x, p, d) ((*tp=(HANDLE)_beginthreadex(NULL, 0, p, d, 0, NULL)) == NULL ? -1 : 0) -#define pthread_cancel(th) TerminateThread(th, 0) -#define pthread_join(th, p) WaitForSingleObject(th, INFINITE) +#define pthread_cancel(th) (!TerminateThread(th, 0)) +#define pthread_join(th, p) (WaitForSingleObject(th, INFINITE)) #define pthread_equal(a, b) ((a) == (b)) -#define pthread_self() GetCurrentThread() +#define pthread_self() (GetCurrentThread()) typedef HANDLE pthread_mutex_t; #define pthread_mutex_init(mp, a) ((*mp = CreateMutex(NULL, FALSE, NULL)) == NULL ? -1 : 0)