Skip to content

Commit 293b166

Browse files
committed
queue: implement queue handles for Windows
1 parent d9710e1 commit 293b166

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/queue.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4611,6 +4611,10 @@ _dispatch_runloop_queue_class_poke(dispatch_queue_t dq)
46114611
result = eventfd_write(handle, 1);
46124612
} while (result == -1 && errno == EINTR);
46134613
(void)dispatch_assume_zero(result);
4614+
#elif defined(_WIN32)
4615+
BOOL bSuccess;
4616+
bSuccess = SetEvent(handle);
4617+
(void)dispatch_assume(bSuccess);
46144618
#else
46154619
#error "runloop support not implemented on this platform"
46164620
#endif
@@ -6312,7 +6316,12 @@ _dispatch_runloop_queue_handle_init(void *ctxt)
63126316
}
63136317
handle = fd;
63146318
#elif defined(_WIN32)
6315-
handle = INVALID_HANDLE_VALUE;
6319+
HANDLE hEvent = CreateEventW(NULL, /*bManualReset=*/TRUE,
6320+
/*bInitialState=*/FALSE, NULL);
6321+
if (hEvent == NULL) {
6322+
DISPATCH_INTERNAL_CRASH(GetLastError(), "CreateEventW");
6323+
}
6324+
handle = hEvent;
63166325
#else
63176326
#error "runloop support not implemented on this platform"
63186327
#endif

0 commit comments

Comments
 (0)