Jeremy Shaw wrote:

import Control.Concurrent
import Control.Concurrent.MVar
import System.Posix.Types

data RW = Read | Write

threadWaitReadWrite :: Fd -> IO RW
threadWaitReadWrite fd =
  do m <- newEmptyMVar
     rid <- forkIO $ threadWaitRead fd  >> putMVar m Read
     wid <- forkIO $ threadWaitWrite fd >> putMVar m Write
     r <- takeMVar m
     killThread rid
     killThread wid
     return r


Initial testing seems promising. I haven't been able to provoke the "leak" during 15-20 minutes of testing.

I'll test more thoroughly during the weekend.

Cheers,

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

Reply via email to