diff --git a/cgroup2/manager.go b/cgroup2/manager.go index a87681bb..b446939d 100644 --- a/cgroup2/manager.go +++ b/cgroup2/manager.go @@ -472,10 +472,6 @@ func (c *Manager) fallbackKill() error { } func (c *Manager) Delete() error { - var ( - tasks []uint64 - threaded bool - ) // Kernel prevents cgroups with running process from being removed, // check the tree is empty. // @@ -485,13 +481,13 @@ func (c *Manager) Delete() error { if !os.IsNotExist(err) { return err } - } else { - threaded = cgType == Threaded } - if threaded { + var tasks []uint64 + switch cgType { + case Threaded, DomainThreaded: tasks, err = c.Threads(true) - } else { + default: tasks, err = c.Procs(true) } if err != nil {