diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-03-27 10:10:47 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-27 10:10:47 +0100 |
commit | b381e63b48a0b6befc7b4e55408c39012a0dcf8c (patch) | |
tree | 92e70447e1b0cf721ef40515db6b97cb881c5066 /tools/perf/util/thread.c | |
parent | Merge branch 'timers/core' into perf/timer, to apply dependent patch (diff) | |
parent | perf: Fix racy group access (diff) | |
download | linux-b381e63b48a0b6befc7b4e55408c39012a0dcf8c.tar.xz linux-b381e63b48a0b6befc7b4e55408c39012a0dcf8c.zip |
Merge branch 'perf/core' into perf/timer, before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r-- | tools/perf/util/thread.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 9ebc8b1f9be5..1c8fbc9588c5 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -82,6 +82,20 @@ void thread__delete(struct thread *thread) free(thread); } +struct thread *thread__get(struct thread *thread) +{ + ++thread->refcnt; + return thread; +} + +void thread__put(struct thread *thread) +{ + if (thread && --thread->refcnt == 0) { + list_del_init(&thread->node); + thread__delete(thread); + } +} + struct comm *thread__comm(const struct thread *thread) { if (list_empty(&thread->comm_list)) @@ -192,7 +206,6 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp) err = thread__set_comm(thread, comm, timestamp); if (err) return err; - thread->comm_set = true; } thread->ppid = parent->tid; |