Skip to content

Commit

Permalink
xous: thread: mark thread_main() as divergent
Browse files Browse the repository at this point in the history
The thread wrapper function never returns, so we can mark it as
divergent.

Signed-off-by: Sean Cross <[email protected]>
  • Loading branch information
xobs committed Jan 13, 2024
1 parent 99b0659 commit 50e4fed
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions library/std/src/sys/pal/xous/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,18 @@ impl Thread {
)
.map_err(|code| io::Error::from_raw_os_error(code as i32))?;

extern "C" fn thread_start(main: *mut usize, guard_page_pre: usize, stack_size: usize) {
extern "C" fn thread_start(
main: *mut usize,
guard_page_pre: usize,
stack_size: usize,
) -> ! {
unsafe {
// Finally, let's run some code.
// Run the contents of the new thread.
Box::from_raw(main as *mut Box<dyn FnOnce()>)();
}

// Destroy TLS, which will free the TLS page and call the destructor for
// any thread local storage.
// any thread local storage (if any).
unsafe {
crate::sys::thread_local_key::destroy_tls();
}
Expand Down

0 comments on commit 50e4fed

Please sign in to comment.