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

25 lines
388 B
Idris

module Main
import Debug.Trace
import System
import System.Concurrency
-- Signal from child
main : IO ()
main = do
mutex <- makeMutex
cond <- makeCondition
threadID <- fork $ do
putStrLn "Hello"
sleep 1
conditionSignal cond
mutexAcquire mutex
conditionWait cond mutex
putStrLn "Goodbye"
mutexRelease mutex
threadWait threadID