Idris2/tests/racket/barrier001/Main.idr

16 lines
307 B
Idris
Raw Normal View History

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"
2023-09-01 13:10:49 +03:00
for_ threadIDs $ \threadID =>
threadWait threadID
sleep 1