diff options
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/go/internal/work/exec.go | 5 | ||||
| -rw-r--r-- | src/cmd/go/internal/work/gc.go | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 654e9e9374..f2d1b1040b 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -248,6 +248,11 @@ func (b *Builder) Do(ctx context.Context, root *Action) { wg.Wait() + if tokens != totalTokens || concurrentProcesses != 0 { + base.Fatalf("internal error: tokens not restored at end of build: tokens: %d, totalTokens: %d, concurrentProcesses: %d", + tokens, totalTokens, concurrentProcesses) + } + // Write action graph again, this time with timing information. writeActionGraph() } diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go index 9a5e6c924c..fc74715f22 100644 --- a/src/cmd/go/internal/work/gc.go +++ b/src/cmd/go/internal/work/gc.go @@ -227,6 +227,7 @@ func compilerConcurrency() (int, func()) { return c, func() { tokensMu.Lock() defer tokensMu.Unlock() + concurrentProcesses-- tokens += c } } @@ -235,6 +236,7 @@ var maxCompilerConcurrency = runtime.GOMAXPROCS(0) // max value we will use for var ( tokensMu sync.Mutex + totalTokens int // total number of tokens: this is used for checking that we get them all back in the end tokens int // number of available tokens concurrentProcesses int // number of currently running compiles ) @@ -246,6 +248,7 @@ func initCompilerConcurrencyPool() { // than what it was when we capped the concurrency to 4. oldConcurrencyCap := min(4, maxCompilerConcurrency) tokens = oldConcurrencyCap * cfg.BuildP + totalTokens = tokens } // trimpath returns the -trimpath argument to use |
