[Haskell-cafe] Re: sendfile leaking descriptors on Linux?
spam at scientician.net
Fri Feb 12 13:00:05 EST 2010
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.
More information about the Haskell-Cafe