Idris2/tests/chez/barrier001/Main.idr
2023-09-07 14:57:22 +01:00

16 lines
307 B
Idris

module Main
import System
import System.Concurrency
main : IO ()
main = do
barrier <- makeBarrier 3
threadIDs <- for [1,2,3] $ \n => fork $ do
putStrLn "Hello"
barrierWait barrier
putStrLn "Goodbye"
for_ threadIDs $ \threadID =>
threadWait threadID
sleep 1