about summary refs log tree commit diff
path: root/src/libstd/sys/cloudabi/thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys/cloudabi/thread.rs')
-rw-r--r--src/libstd/sys/cloudabi/thread.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstd/sys/cloudabi/thread.rs b/src/libstd/sys/cloudabi/thread.rs
index a3595debaf5..112bb1ce3af 100644
--- a/src/libstd/sys/cloudabi/thread.rs
+++ b/src/libstd/sys/cloudabi/thread.rs
@@ -4,8 +4,8 @@ use crate::io;
 use crate::mem;
 use crate::ptr;
 use crate::sys::cloudabi::abi;
+use crate::sys::stack_overflow;
 use crate::sys::time::checked_dur2intervals;
-use crate::sys_common::thread::*;
 use crate::time::Duration;
 
 pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024;
@@ -49,7 +49,11 @@ impl Thread {
 
         extern "C" fn thread_start(main: *mut libc::c_void) -> *mut libc::c_void {
             unsafe {
-                start_thread(main as *mut u8);
+                // Next, set up our stack overflow handler which may get triggered if we run
+                // out of stack.
+                let _handler = stack_overflow::Handler::new();
+                // Finally, let's run some code.
+                Box::from_raw(main as *mut Box<dyn FnOnce()>)();
             }
             ptr::null_mut()
         }