[Haskell-cafe] Interrupting threads and ualarm
ROBERT DOUGLAS HOELZ
hoelz at wisc.edu
Fri Nov 23 16:14:53 EST 2007
Hello Haskellers,
I have two questions for you:
* Is there a Haskell binding to the ualarm() function in unistd.h? I looked in System.Posix.Signals, but there's just a binding for alarm().
* Is there a way to interrupt a blocking operation on another thread? I thought about throwTo, but that seems like overkill. Here's some example code:
import Control.Concurrent
main :: IO ()
main = do
tid <- myThreadId
forkIO $ interruptMain tid
getChar
interruptMain :: ThreadId -> IO ()
interruptMain mainThreadId = do
threadDelay 5000000
interrupt mainThreadId -- This is probably going to end up being throwTo, isn't it?
More information about the Haskell-Cafe
mailing list