Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
A module of concurrent higher order functions.
Synopsis
- data ExceptionList = ExceptionList [SomeException]
- data ConcException = ConcException
- type ConcurrentMethod t t2 = Over (Kleisli ((->) Int)) IO () t () t2
- type ConcurrentMethodAdapter t t2 = Pool -> (Int -> ConcurrentMethod t t2) -> Int -> ConcurrentMethod t t2
- module Control.CUtils.ThreadPool
- simpleConc_ :: Foldable f => Pool -> f (IO ()) -> () -> IO ()
- concurrent_ :: Pool -> Int -> ConcurrentMethod () t
- throwToCallerAdapter_ :: Pool -> (t1 -> ConcurrentMethod () ()) -> t1 -> ConcurrentMethod () ()
- toNewStyle :: ((Int -> IO t2) -> IO t) -> ConcurrentMethod t t2
Documentation
data ExceptionList Source #
For exceptions caused by caller code.
Instances
Show ExceptionList Source # | |
Defined in Control.CUtils.CPUMultiThreading showsPrec :: Int -> ExceptionList -> ShowS # show :: ExceptionList -> String # showList :: [ExceptionList] -> ShowS # | |
Exception ExceptionList Source # | |
Defined in Control.CUtils.CPUMultiThreading |
data ConcException Source #
For internal errors. If a procedure throws this, some threads it created may still be running. This exception type is provided out of an abundance of caution, in case you want to take precautions against the activities of threads that for whatever reason cannot be terminated. If thrown it is never among the exceptions listed inside an ExceptionList.
Instances
Show ConcException Source # | |
Defined in Control.CUtils.CPUMultiThreading showsPrec :: Int -> ConcException -> ShowS # show :: ConcException -> String # showList :: [ConcException] -> ShowS # | |
Exception ConcException Source # | |
Defined in Control.CUtils.CPUMultiThreading |
type ConcurrentMethod t t2 = Over (Kleisli ((->) Int)) IO () t () t2 Source #
A type for methods that accept a list of tasks.
type ConcurrentMethodAdapter t t2 = Pool -> (Int -> ConcurrentMethod t t2) -> Int -> ConcurrentMethod t t2 Source #
A type for functions that transform a base method, taking a thread pool also.
module Control.CUtils.ThreadPool
simpleConc_ :: Foldable f => Pool -> f (IO ()) -> () -> IO () Source #
Run the collection of tasks in the specified thread pool. Each task does not necessarily get its own thread--a best effort is made to spread the load over all threads in the thread pool.
concurrent_ :: Pool -> Int -> ConcurrentMethod () t Source #
This function implements some policy for simpleConc_
. simpleConc_
makes the guarantee
that the tasks given as an argument, map one-to-one to the tasks run on the thread pool.
This guarantee is dropped for the function concurrent_
, which allows more optimization.
In order to get the tasks, the integer argument n
is accepted and the functional
mnds
is evaluated in the range 0 to n-1 inclusive.
throwToCallerAdapter_ :: Pool -> (t1 -> ConcurrentMethod () ()) -> t1 -> ConcurrentMethod () () Source #
An adapter which modifies the argument concurrent method, to implement an exception handling policy in which exceptions are collected in a list, which is thrown as an exception in the caller. This appropriates the exception handling behavior of old versions of this package.
toNewStyle :: ((Int -> IO t2) -> IO t) -> ConcurrentMethod t t2 Source #