Skip to content

Commit

Permalink
fixes #23732, os.sleep(-1) now returns immediately (#23734)
Browse files Browse the repository at this point in the history
fixes #23732
  • Loading branch information
litlighilit authored Jun 18, 2024
1 parent c58b6e8 commit 2a658c6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/pure/os.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a658c6

Please sign in to comment.