Skip to content

Commit

Permalink
thread/name: Avoid calling C function known to return 0
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Mar 20, 2024
1 parent 9480181 commit 8fd082e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/thread/riot_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ impl KernelPID {
}

pub fn get_name(&self) -> Option<&str> {
// Shortcut through an otherwise unoptimizable function
if !cfg!(riot_develhelp) {
return None;
}

let ptr = unsafe { raw::thread_getname(self.0) };

// If the thread stops, the name might be not valid any more, but then again the getname
Expand Down

0 comments on commit 8fd082e

Please sign in to comment.