Idris2/tests/racket/conditions006/Main.idr
2021-03-15 13:43:12 +00:00

20 lines
460 B
Idris

-- Idris2
import System
import System.Concurrency
-- Test `conditionWaitTimeout` times out for 1 main and 1 child thread
main : IO ()
main =
do cvMutex <- makeMutex
cv <- makeCondition
t <- fork $ do mutexAcquire cvMutex
conditionWaitTimeout cv cvMutex 1000000
putStrLn "Where are you mother?"
mutexRelease cvMutex
sleep 2
putStrLn "Sorry I'm late child!"
threadWait t