mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
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>
This commit is contained in:
@@ -68,14 +68,18 @@ pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user