Skip to content

Commit 640c206

Browse files
committed
Support cgroup.AddThread in cgroupv2 manager
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>
1 parent 04ebfd6 commit 640c206

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

v2/manager.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,14 @@ func (c *Manager) AddProc(pid uint64) error {
336336
return writeValues(c.path, []Value{v})
337337
}
338338

339+
func (c *Manager) AddThread(tid uint64) error {
340+
v := Value{
341+
filename: cgroupThreads,
342+
value: tid,
343+
}
344+
return writeValues(c.path, []Value{v})
345+
}
346+
339347
func (c *Manager) Delete() error {
340348
return remove(c.path)
341349
}

v2/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737

3838
const (
3939
cgroupProcs = "cgroup.procs"
40+
cgroupThreads = "cgroup.threads"
4041
defaultDirPerm = 0755
4142
)
4243

0 commit comments

Comments
 (0)