pool-0.0.1: Thread-safe resource pools.

Data.Pool

Contents

Synopsis

Using pools

createPool :: (MonadIO m, MonadPeelIO m) => IO a -> (a -> IO ()) -> Int -> (Pool a -> m b) -> m bSource

createPoolCheckAliveSource

Arguments

:: (MonadIO m, MonadPeelIO m) 
=> IO a 
-> (a -> IO ()) 
-> Int 
-> (Pool a -> m b) 
-> (a -> IO Bool)

is the resource alive?

-> m b 

withPool :: (MonadIO m, MonadPeelIO m) => Pool a -> (a -> m b) -> m (Maybe b)Source

withPool' :: (MonadIO m, MonadPeelIO m) => Pool a -> (a -> m b) -> m bSource

This function throws a PoolExhaustedException when no resources are available. See withPoolAllocate to avoid this.

withPoolAllocate :: MonadPeelIO m => Pool a -> (a -> m b) -> m bSource

Same as withPool', but instead of throwing a PoolExhaustedException when there the maximum number of resources are created and allocated, it allocates a new resource, passes it to the subprocess and then frees it.

data Pool a Source

Diagnostics