Skip to content

Commit

Permalink
Merge pull request haskell#10055 from wismill/semaphore/verbosity
Browse files Browse the repository at this point in the history
fix: Make newSemaphoreJobControl respect verbosity
  • Loading branch information
mergify[bot] authored May 30, 2024
2 parents 3a8c69c + 225d2b1 commit f323d29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions cabal-install/src/Distribution/Client/JobControl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import Control.Monad (forever, replicateM_)
import Distribution.Client.Compat.Semaphore
import Distribution.Compat.Stack
import Distribution.Simple.Utils
import Distribution.Verbosity
import System.Semaphore

-- | A simple concurrency abstraction. Jobs can be spawned and can complete
Expand Down Expand Up @@ -171,13 +170,13 @@ readAllTChan qvar = go []
--
-- This uses the GHC -jsem option to allow GHC to take additional semaphore slots
-- if we are not using them all.
newSemaphoreJobControl :: WithCallStack (Int -> IO (JobControl IO a))
newSemaphoreJobControl n
newSemaphoreJobControl :: WithCallStack (Verbosity -> Int -> IO (JobControl IO a))
newSemaphoreJobControl _ n
| n < 1 || n > 1000 =
error $ "newParallelJobControl: not a sensible number of jobs: " ++ show n
newSemaphoreJobControl maxJobLimit = do
newSemaphoreJobControl verbosity maxJobLimit = do
sem <- freshSemaphore "cabal_semaphore" maxJobLimit
notice normal $
notice verbosity $
"Created semaphore called "
++ getSemaphoreName (semaphoreName sem)
++ " with "
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/ProjectBuilding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ rebuildTargets
NumJobs n -> newParallelJobControl (fromMaybe numberOfProcessors n)
UseSem n ->
if jsemSupported compiler
then newSemaphoreJobControl n
then newSemaphoreJobControl verbosity n
else do
warn verbosity "-jsem is not supported by the selected compiler, falling back to normal parallelism control."
newParallelJobControl n
Expand Down

0 comments on commit f323d29

Please sign in to comment.