Idris2/tests/racket/conditions002/Main.idr
Wen Kokke bd683938bf
Overhaul of concurrency primitives (#968)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-05 16:16:20 +00:00

22 lines
358 B
Idris

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