diff options
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r-- | tools/perf/util/thread.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 9ebc8b1f9be5..a5dbba95107f 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -82,6 +82,20 @@ void thread__delete(struct thread *thread) | |||
82 | free(thread); | 82 | free(thread); |
83 | } | 83 | } |
84 | 84 | ||
85 | struct thread *thread__get(struct thread *thread) | ||
86 | { | ||
87 | ++thread->refcnt; | ||
88 | return thread; | ||
89 | } | ||
90 | |||
91 | void thread__put(struct thread *thread) | ||
92 | { | ||
93 | if (thread && --thread->refcnt == 0) { | ||
94 | list_del_init(&thread->node); | ||
95 | thread__delete(thread); | ||
96 | } | ||
97 | } | ||
98 | |||
85 | struct comm *thread__comm(const struct thread *thread) | 99 | struct comm *thread__comm(const struct thread *thread) |
86 | { | 100 | { |
87 | if (list_empty(&thread->comm_list)) | 101 | if (list_empty(&thread->comm_list)) |