summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorIvan Bobev <bobeff@gmail.com>2021-07-09 03:26:49 +0300
committerGitHub <noreply@github.com>2021-07-08 20:26:49 -0400
commit86f5a56fcdbdbd4748c979e6f517d8dfc64857f7 (patch)
tree438b5f8c9f9fbf4eaea2fcf4ee3854f94464e2dc /lib
parent0e44d137f97a8206af1f2747391615e2f237f000 (diff)
downloadNim-86f5a56fcdbdbd4748c979e6f517d8dfc64857f7.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/asyncdispatch.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index 17fd5f824..d98ca77df 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -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)