Safe Haskell | None |
---|
A futures implementation that integrates with shelly
jobs 5 (\job -> background job (sleep 2) >> background job (sleep 1))
jobs
will wait for all concurrent jobs to finish.
The argument to jobs is the maximum number of concurrent tasks.
Generally shell scripts contain a lot of quick commands, but when you have the occasional command that is noticeably long and independent of other commands, you can easily run it concurrently.
Running external commands asynchronously.
jobs :: Int -> (BgJobManager -> Sh a) -> Sh aSource
Create a BgJobManager
that has a limit
on the max number of background tasks.
an invocation of jobs is independent of any others, and not tied to the Sh monad in any way.
This blocks the execution of the program until all background
jobs are finished.
background :: BgJobManager -> Sh a -> Sh (BgResult a)Source
Run the Sh
task asynchronously in the background, returns
the `BgResult a`, a promise immediately. Run getBgResult to wait for the result.
The background task will inherit the current Sh context
The BgJobManager
ensures the max jobs limit must be sufficient for the parent and all children.
getBgResult :: BgResult a -> Sh aSource
Returns the promised result from a backgrounded task. Blocks until the task completes.