Skip to content

Commit 2f76085

Browse files
authored
Merge pull request #595 from triplef/win-thread-mta
[Win32] Initialize COM on background dispatch queue threads
2 parents 9566a13 + be275d4 commit 2f76085

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/queue.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -6264,8 +6264,13 @@ _dispatch_worker_thread(void *context)
62646264
static unsigned WINAPI
62656265
_dispatch_worker_thread_thunk(LPVOID lpParameter)
62666266
{
6267-
_dispatch_worker_thread(lpParameter);
6268-
return 0;
6267+
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
6268+
if (FAILED(hr)) {
6269+
_dispatch_client_assert_fail("Error %ld initializing Windows Runtime", hr);
6270+
}
6271+
_dispatch_worker_thread(lpParameter);
6272+
CoUninitialize();
6273+
return 0;
62696274
}
62706275
#endif // defined(_WIN32)
62716276
#endif // DISPATCH_USE_PTHREAD_POOL

0 commit comments

Comments
 (0)