[Haskell-beginners] How to interact with a process

Martin Drautzburg Martin.Drautzburg at web.de
Fri Feb 1 22:17:06 CET 2013

Okay I tried forkIO in the following way:

playBg = do 
       t <- forkIO play
       putStrLn "playing"

And indeed it  plays in background. 

But can't seem to get the killing to work. 

playBg = do 
       t <- forkIO play
       putStrLn "playing"
       c <- getChar
       putStrLn "interrrupted"
       killThread t 

When I enter "asd" while playing I see:

*Main> playBg

But it just goes on playing. Can a thread refuse to get killed, or am I doing 
something stupid?

More information about the Beginners mailing list