From be275d48811d26377e856544a05312c8994c9c6c Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Wed, 23 Feb 2022 09:41:28 +0100 Subject: [PATCH] [Win32] Initialize COM library on queue threads --- src/queue.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/queue.c b/src/queue.c index efafe923f..40f059c7a 100644 --- a/src/queue.c +++ b/src/queue.c @@ -6264,8 +6264,13 @@ _dispatch_worker_thread(void *context) static unsigned WINAPI _dispatch_worker_thread_thunk(LPVOID lpParameter) { - _dispatch_worker_thread(lpParameter); - return 0; + HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE); + if (FAILED(hr)) { + _dispatch_client_assert_fail("Error %ld initializing Windows Runtime", hr); + } + _dispatch_worker_thread(lpParameter); + CoUninitialize(); + return 0; } #endif // defined(_WIN32) #endif // DISPATCH_USE_PTHREAD_POOL