diff options
| author | Sean Cross <sean@xobs.io> | 2023-12-29 19:16:43 +0800 |
|---|---|---|
| committer | Sean Cross <sean@xobs.io> | 2024-01-13 09:38:42 -0800 |
| commit | 50e4fede2427f54cbdb9e4d556aa9ef4c68332fb (patch) | |
| tree | ef7516a90fecdf50f0f6a59403b457e4f28c20ea | |
| parent | 99b06594a8fc0bbfa2fe86ee3a31c71bf8586166 (diff) | |
| download | rust-50e4fede2427f54cbdb9e4d556aa9ef4c68332fb.tar.gz rust-50e4fede2427f54cbdb9e4d556aa9ef4c68332fb.zip | |
xous: thread: mark thread_main() as divergent
The thread wrapper function never returns, so we can mark it as divergent. Signed-off-by: Sean Cross <sean@xobs.io>
| -rw-r--r-- | library/std/src/sys/pal/xous/thread.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/std/src/sys/pal/xous/thread.rs b/library/std/src/sys/pal/xous/thread.rs index 78c68de7bf3..0f452e07a5c 100644 --- a/library/std/src/sys/pal/xous/thread.rs +++ b/library/std/src/sys/pal/xous/thread.rs @@ -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(); } |
