2016-09-09 12:57:42 -04:00
|
|
|
{- Copyright 2016 Joey Hess <id@joeyh.name>
|
|
|
|
-
|
2019-03-13 15:48:14 -04:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2016-09-09 12:57:42 -04:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Types.Concurrency where
|
|
|
|
|
2019-05-10 13:24:31 -04:00
|
|
|
import Utility.PartialPrelude
|
|
|
|
|
2019-06-17 14:58:02 -04:00
|
|
|
-- Note that Concurrent 1 is not the same as NonConcurrent;
|
|
|
|
-- the former specifies 1 job of each particular kind, but there can be
|
|
|
|
-- more than one kind of job running concurrently.
|
2019-05-10 13:24:31 -04:00
|
|
|
data Concurrency = NonConcurrent | Concurrent Int | ConcurrentPerCpu
|
2020-04-20 13:53:27 -04:00
|
|
|
deriving (Eq)
|
2019-05-10 13:24:31 -04:00
|
|
|
|
|
|
|
parseConcurrency :: String -> Maybe Concurrency
|
|
|
|
parseConcurrency "cpus" = Just ConcurrentPerCpu
|
|
|
|
parseConcurrency "cpu" = Just ConcurrentPerCpu
|
|
|
|
parseConcurrency s = Concurrent <$> readish s
|
2020-09-16 11:41:28 -04:00
|
|
|
|
|
|
|
-- Concurrency can be configured at the command line or by git config.
|
|
|
|
data ConcurrencySetting
|
|
|
|
= ConcurrencyCmdLine Concurrency
|
|
|
|
| ConcurrencyGitConfig Concurrency
|
2021-11-19 11:53:25 -04:00
|
|
|
deriving (Eq)
|