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 <sean@xobs.io>
  • Loading branch information
xobs committed Dec 29, 2023
1 parent bb93b45 commit 663e7ab
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions library/std/src/sys/xous/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,20 @@ 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) {
unsafe {
// Finally, let's run some code.
Box::from_raw(main as *mut Box<dyn FnOnce()>)();
extern "C" fn thread_start(
main: *mut usize,
guard_page_pre: usize,
stack_size: usize,
) -> ! {
{
unsafe {
// 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 663e7ab

Please sign in to comment.