potoki 0.7.2 → 0.7.3
raw patch · 3 files changed
+15/−1 lines, 3 files
Files
library/Potoki/Transform.hs view
@@ -22,6 +22,7 @@ -- * Concurrency N.bufferize, N.concurrently,+ N.async, -- * File IO deleteFile, appendBytesToFile,
library/Potoki/Transform/Concurrency.hs view
@@ -2,6 +2,7 @@ ( bufferize, concurrently,+ async, ) where @@ -81,3 +82,15 @@ Nothing -> do putMVar activeWorkersAmountVar (pred activeWorkersAmount) loop++{-|+A transform, which fetches the inputs asynchronously on the specified number of threads.+-}+async :: Int -> Transform input input+async workersAmount =+ Transform $ \ (A.Fetch fetchIO) -> do+ chan <- newEmptyMVar + replicateM_ workersAmount $ forkIO $ fix $ \ loop -> do+ fetchResult <- fetchIO Nothing Just+ putMVar chan fetchResult+ return (A.finiteMVar chan)
potoki.cabal view
@@ -1,7 +1,7 @@ name: potoki version:- 0.7.2+ 0.7.3 synopsis: Simple streaming in IO description: