Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
wip-parallel-experiment drop parallelFor_ for now
Browse files Browse the repository at this point in the history
  • Loading branch information
gkaracha committed Apr 29, 2020
1 parent 509827f commit d9cf3fb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions asterius/src/Asterius/Internals/Parallel.hs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module Asterius.Internals.Parallel
( parallelFor,
parallelFor_,
( parallelFor
-- parallelFor_,
)
where

import Control.Concurrent
import Control.Concurrent.MVar
import Control.Monad

-- | Given the worker thread pool capacity @c@, @parallelFor c xs f@ maps @f@
-- on @xs@ in parallel on the global thread pool (the results are ignored). If
-- @c = 1@ then it is equivalent to @mconcat <$> mapM fn xs@, thus avoiding
-- threading overhead.
{-# INLINE parallelFor_ #-}
parallelFor_ :: Int -> [a] -> (a -> IO r) -> IO ()
parallelFor_ n xs fn
| n >= 2 = error "TODO"
-- If there are not enough resources, fall back to the sequential version.
| otherwise = mapM_ fn xs
-- -- | Given the worker thread pool capacity @c@, @parallelFor c xs f@ maps @f@
-- -- on @xs@ in parallel on the global thread pool (the results are ignored). If
-- -- @c = 1@ then it is equivalent to @mconcat <$> mapM fn xs@, thus avoiding
-- -- threading overhead.
-- {-# INLINE parallelFor_ #-}
-- parallelFor_ :: Int -> [a] -> (a -> IO r) -> IO ()
-- parallelFor_ n xs fn
-- | n >= 2 = error "TODO"
-- -- If there are not enough resources, fall back to the sequential version.
-- | otherwise = mapM_ fn xs

-- | Given the worker thread pool capacity @c@, @parallelFor c xs f@ maps @f@
-- on @xs@ in parallel on the global thread pool, and concatenates the results.
Expand Down

0 comments on commit d9cf3fb

Please sign in to comment.