package gomaxprocs
import "gvisor.dev/gvisor/pkg/gomaxprocs"
Package gomaxprocs synchronizes adjustments to GOMAXPROCS. When this package is active (i.e. after the first call to SetBase), it sets the value of GOMAXPROCS to a "base" value (which should be set by a single goroutine, without races) plus a non-negative "temporary" value (which may be concurrently increased or decreased by multiple goroutines).
Note that changing GOMAXPROCS stops the world, so callers should adjust GOMAXPROCS infrequently.
TODO: Add gomaxprocs.Get() and check that other gVisor packages don't call runtime.GOMAXPROCS() at all.
Index ¶
Functions ¶
func Add ¶
func Add(n int)
Add adds n temporary GOMAXPROCS. n may be negative; callers should call Add with negative n to remove temporary GOMAXPROCS when they are no longer needed.
func SetBase ¶
func SetBase(n int)
SetBase sets base GOMAXPROCS.
Source Files ¶
gomaxprocs.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 4 hours ago –
Tools for package owners.