mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-27 05:34:40 +03:00
20 lines
417 B
Idris
20 lines
417 B
Idris
|
-- Idris2
|
||
|
|
||
|
import System
|
||
|
import System.Concurrency
|
||
|
|
||
|
-- Test `conditionBroadcast` wakes the child with 1 main and 1 child thread
|
||
|
|
||
|
main : IO ()
|
||
|
main =
|
||
|
do cvMutex <- makeMutex
|
||
|
cv <- makeCondition
|
||
|
t <- fork $ do mutexAcquire cvMutex
|
||
|
conditionWait cv cvMutex
|
||
|
putStrLn "Hello mother"
|
||
|
putStrLn "Hello child"
|
||
|
sleep 1
|
||
|
conditionBroadcast cv
|
||
|
threadWait t
|
||
|
|