Skip to content

Conversation

secDre4mer
Copy link

coinitService implicitly required that runtime.LockOSThread() was called before (because ole.CoInitializeEx requires that all later calls happen on the same thread). This was true for one location that called coinitService, but not for another, causing WMI failures if the go runtime moved the go routine to another thread during the WMI calls.
To fix this, explicitly call runtime.LockOSThread() in coinitService and runtime.UnlockOSThread() in the cleanup.

coinitService implicitly required that runtime.LockOSThread() was
called before (because ole.CoInitializeEx requires that all later
calls happen on the same thread). This was true for one location
that called coinitService, but not for another, causing WMI
failures if the go runtime moved the go routine to another thread
during the WMI calls.
To fix this, explicitly call runtime.LockOSThread() in coinitService
and runtime.UnlockOSThread() in the cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant