github.com/bigcommerce/nomad@v0.9.3-bc/drivers/shared/executor/resource_container_linux.go (about) 1 package executor 2 3 import ( 4 "os" 5 "sync" 6 7 cgroupConfig "github.com/opencontainers/runc/libcontainer/configs" 8 ) 9 10 // resourceContainerContext is a platform-specific struct for managing a 11 // resource container. In the case of Linux, this is used to control Cgroups. 12 type resourceContainerContext struct { 13 groups *cgroupConfig.Cgroup 14 cgLock sync.Mutex 15 } 16 17 // cleanup removes this host's Cgroup from within an Executor's context 18 func (rc *resourceContainerContext) executorCleanup() error { 19 rc.cgLock.Lock() 20 defer rc.cgLock.Unlock() 21 if err := DestroyCgroup(rc.groups, os.Getpid()); err != nil { 22 return err 23 } 24 return nil 25 }