Merge pull request #355 from zhuangel:master

PiperOrigin-RevId: 258643966
This commit is contained in:
gVisor bot 2019-07-17 14:38:22 -07:00
commit 609cd91e3f
1 changed files with 14 additions and 2 deletions

View File

@ -250,8 +250,20 @@ func (ns *PIDNamespace) allocateTID() (ThreadID, error) {
}
// Is it available?
_, ok := ns.tasks[tid]
if !ok {
tidInUse := func() bool {
if _, ok := ns.tasks[tid]; ok {
return true
}
if _, ok := ns.processGroups[ProcessGroupID(tid)]; ok {
return true
}
if _, ok := ns.sessions[SessionID(tid)]; ok {
return true
}
return false
}()
if !tidInUse {
ns.last = tid
return tid, nil
}