Skip to content

Commit

Permalink
Support cgroup.AddThread in cgroupv2 manager
Browse files Browse the repository at this point in the history
In threaded mode, we need to add thread id to cgroup.threads. This work is to make the cgroupv2 manager support AddThread().

Fixes: #242

Signed-off-by: yaoyinnan <yaoyinnan@foxmail.com>
  • Loading branch information
yaoyinnan committed Sep 9, 2022
1 parent 04ebfd6 commit 640c206
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ func (c *Manager) AddProc(pid uint64) error {
return writeValues(c.path, []Value{v})
}

func (c *Manager) AddThread(tid uint64) error {
v := Value{
filename: cgroupThreads,
value: tid,
}
return writeValues(c.path, []Value{v})
}

func (c *Manager) Delete() error {
return remove(c.path)
}
Expand Down
1 change: 1 addition & 0 deletions v2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (

const (
cgroupProcs = "cgroup.procs"
cgroupThreads = "cgroup.threads"
defaultDirPerm = 0755
)

Expand Down

0 comments on commit 640c206

Please sign in to comment.