diff options
Diffstat (limited to 'worker/types')
-rw-r--r-- | worker/types/thread.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/worker/types/thread.go b/worker/types/thread.go index a51a5c4..4a97ef6 100644 --- a/worker/types/thread.go +++ b/worker/types/thread.go @@ -3,6 +3,21 @@ package types type Thread struct { Uid uint32 Children []*Thread + Parent *Thread +} + +func (t *Thread) Find(uid uint32) *Thread { + if t.Uid == uid { + return t + } + + for _, child := range t.Children { + if needle := child.Find(uid); needle != nil { + return needle + } + } + + return nil } func (t *Thread) FormatThread(cb func(*Thread, []rune) bool) { |