mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 12:42:02 +03:00
21 lines
441 B
Idris
21 lines
441 B
Idris
-- Idris2
|
|
|
|
import System
|
|
import System.Concurrency
|
|
|
|
-- Test `conditionSignal` works for 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"
|
|
mutexRelease cvMutex
|
|
putStrLn "Hello child"
|
|
sleep 1
|
|
conditionSignal cv
|
|
threadWait t
|
|
|