Skip to content

Commit ad8f348

Browse files
committed
minor: Fix pthread_cancel compat
1 parent dc95819 commit ad8f348

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/compat_pthread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#define THREAD_RETURN unsigned int
1616
typedef HANDLE pthread_t;
1717
#define pthread_create(tp, x, p, d) ((*tp=(HANDLE)_beginthreadex(NULL, 0, p, d, 0, NULL)) == NULL ? -1 : 0)
18-
#define pthread_cancel(th) TerminateThread(th, 0)
19-
#define pthread_join(th, p) WaitForSingleObject(th, INFINITE)
18+
#define pthread_cancel(th) (!TerminateThread(th, 0))
19+
#define pthread_join(th, p) (WaitForSingleObject(th, INFINITE))
2020
#define pthread_equal(a, b) ((a) == (b))
21-
#define pthread_self() GetCurrentThread()
21+
#define pthread_self() (GetCurrentThread())
2222

2323
typedef HANDLE pthread_mutex_t;
2424
#define pthread_mutex_init(mp, a) ((*mp = CreateMutex(NULL, FALSE, NULL)) == NULL ? -1 : 0)

0 commit comments

Comments
 (0)