Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
import Control.Concurrent
|
||||
import Control.Monad
|
||||
import Data.Maybe
|
||||
import System.IO
|
||||
|
||||
main = do
|
||||
c <- newEmptyMVar
|
||||
hSetBuffering stdin NoBuffering
|
||||
forkIO $ do
|
||||
a <- getChar
|
||||
putMVar c a
|
||||
putStrLn $ "\nChar '" ++ [a] ++
|
||||
"' read and stored in MVar"
|
||||
wait c
|
||||
where wait c = do
|
||||
a <- tryTakeMVar c
|
||||
if isJust a then return ()
|
||||
else putStrLn "Awaiting char.." >>
|
||||
threadDelay 500000 >> wait c
|
||||
Loading…
Add table
Add a link
Reference in a new issue