summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorlit <litlighilit@foxmail.com>2024-06-18 23:39:34 +0800
committerGitHub <noreply@github.com>2024-06-18 17:39:34 +0200
commit2a658c64d8c24ad4a0944e01ba3e005bfb12534f (patch)
tree5919da119ae055ab4557dbdc8331cb77759f4070 /lib
parentc58b6e8df895c2f7d3f56a2bb0ef9a778f7a4269 (diff)
downloadNim-2a658c64d8c24ad4a0944e01ba3e005bfb12534f.tar.gz
fixes #23732, os.sleep(-1) now returns immediately (#23734)
fixes #23732
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/os.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 6a7b4af1b..78ebb1c88 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -692,7 +692,10 @@ proc getAppDir*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect], noWeirdT
 
 proc sleep*(milsecs: int) {.rtl, extern: "nos$1", tags: [TimeEffect], noWeirdTarget.} =
   ## Sleeps `milsecs` milliseconds.
+  ## A negative `milsecs` causes sleep to return immediately.
   when defined(windows):
+    if milsecs < 0:
+      return  # fixes #23732
     winlean.sleep(int32(milsecs))
   else:
     var a, b: Timespec