Fix a bug with starting of asynchronous processes (#18464)

The asynchronous process completion handler callback should be called
only once. This is achieved by passing `WT_EXECUTEONLYONCE` flag to the
`registerWaitForSingleObject` Windows API procedure.

Related to cheatfate/asynctools#35
This commit is contained in:
Ivan Bobev
2021-07-09 03:26:49 +03:00
committed by GitHub
parent 0e44d137f9
commit 86f5a56fcd

View File

@@ -1022,7 +1022,7 @@ when defined(windows) or defined(nimdoc):
raiseOSError(osLastError())
var pcd = cast[PostCallbackDataPtr](allocShared0(sizeof(PostCallbackData)))
var flags = WT_EXECUTEINWAITTHREAD.DWORD
var flags = WT_EXECUTEINWAITTHREAD.DWORD or WT_EXECUTEONLYONCE.DWORD
proc proccb(fd: AsyncFD, bytesCount: DWORD, errcode: OSErrorCode) =
closeWaitable(hProcess)