Skip to content

Commit

Permalink
Merge pull request #595 from triplef/win-thread-mta
Browse files Browse the repository at this point in the history
[Win32] Initialize COM on background dispatch queue threads
  • Loading branch information
compnerd authored Sep 13, 2023
2 parents 9566a13 + be275d4 commit 2f76085
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f76085

Please sign in to comment.