Skip to content

Commit

Permalink
Merge pull request #5102 from unisonweb/fix/3957
Browse files Browse the repository at this point in the history
  • Loading branch information
aryairani committed Jun 18, 2024
2 parents 898265e + a052745 commit dcd37fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion parser-typechecker/src/Unison/Runtime/Builtin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2599,8 +2599,16 @@ declareForeigns = do

declareForeign Tracked "IO.kill.impl.v3" boxToEF0 $ mkForeignIOF killThread

let mx :: Word64
mx = fromIntegral (maxBound :: Int)

customDelay :: Word64 -> IO ()
customDelay n
| n < mx = threadDelay (fromIntegral n)
| otherwise = threadDelay maxBound >> customDelay (n - mx)

declareForeign Tracked "IO.delay.impl.v3" natToEFUnit $
mkForeignIOF threadDelay
mkForeignIOF customDelay

declareForeign Tracked "IO.stdHandle" standard'handle
. mkForeign
Expand Down

0 comments on commit dcd37fa

Please sign in to comment.