I really don't use more FFI than needed to send and receive binary packets over the network. I don't even use FPS these days and all the allocaBytes code checks for nullPtr.

My hunch is that this is to do with killing threads that perform FFI in my timeout code. It would kill blocking connect and hGet operations for example.

timeout :: forall a.Show a => Int -> IO a -> IO a
timeout secs fun =
    do mvar <- newEmptyMVar
       tid1 <- forkIO $ do result <- try fun
                           putMVar mvar $
                                   either (Left . show) (Right . id)
                                           result
       tid2 <- forkIO $ do threadDelay (secs * 1000000)
                           putMVar mvar (Left "timeout")
       maybeResult <- takeMVar mvar
       forkIO $ do killThread tid1
                   killThread tid2
       case maybeResult of
         Right a -> return a
         Left b -> fail b

On Nov 16, 2005, at 5:52 PM, Tomasz Zielonka wrote:

Let me guess - excessive use of unsafe operations (like unsafe*, FFI)?
I've got an impression that you use them too often for a fresh Haskell
programmer. Too often for a Haskell programmer in general.

--
http://wagerlabs.com/





_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to