Skip to content

Commit

Permalink
Ensure new non-main threads have their names set
Browse files Browse the repository at this point in the history
  • Loading branch information
jamienicol committed Apr 17, 2024
1 parent b994963 commit f8a67e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions samply/src/linux_shared/process_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ impl ProcessThreads {
}
match self.threads_by_tid.entry(tid) {
Entry::Vacant(entry) => {
if let (Some(name), Some(thread_recycler)) = (name, self.thread_recycler.as_mut()) {
if let Some(thread_handle) = thread_recycler.recycle_by_name(&name) {
if let (Some(name), Some(thread_recycler)) = (&name, self.thread_recycler.as_mut())
{
if let Some(thread_handle) = thread_recycler.recycle_by_name(name) {
let thread = Thread::new(thread_handle);
return entry.insert(thread);
}
}

let thread_handle =
profile.add_thread(self.profile_process, tid as u32, start_time, false);
if let Some(name) = &name {
profile.set_thread_name(thread_handle, name);
}
let thread = Thread::new(thread_handle);
entry.insert(thread)
}
Expand Down

0 comments on commit f8a67e8

Please sign in to comment.