summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-10-09 20:27:10 +0000
committergVisor bot <gvisor-bot@google.com>2020-10-09 20:27:10 +0000
commitc2efbcaa5bb105e652045ee720e8acec1e2bc50d (patch)
treeaac087c032a3c01ad805f89fe8ab351e4dce6dc8 /pkg/sentry/kernel
parent7efef955446e07a32094e3022767e45937ee3aab (diff)
parent6bbf66227136a29cd8e2f51166216b9a70fdfae5 (diff)
Merge release-20200928.0-81-g6bbf66227 (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/threads.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/threads.go b/pkg/sentry/kernel/threads.go
index 5ae5906e8..fdadb52c0 100644
--- a/pkg/sentry/kernel/threads.go
+++ b/pkg/sentry/kernel/threads.go
@@ -265,6 +265,13 @@ func (ns *PIDNamespace) Tasks() []*Task {
return tasks
}
+// NumTasks returns the number of tasks in ns.
+func (ns *PIDNamespace) NumTasks() int {
+ ns.owner.mu.RLock()
+ defer ns.owner.mu.RUnlock()
+ return len(ns.tids)
+}
+
// ThreadGroups returns a snapshot of the thread groups in ns.
func (ns *PIDNamespace) ThreadGroups() []*ThreadGroup {
return ns.ThreadGroupsAppend(nil)