]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/windows/thread.rs
Change sys::Thread::new to take the thread entry as Box<dyn FnBox() + 'static>̣
[rust.git] / src / libstd / sys / windows / thread.rs
index b6f63303dc2f0af374d731305059f9c8a45008d5..1a97dd10ced8d2c284b299b84a8f5c3caa236c17 100644 (file)
@@ -28,7 +28,8 @@ pub struct Thread {
 }
 
 impl Thread {
-    pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
+    // unsafe: see thread::Builder::spawn_unchecked for safety requirements
+    pub unsafe fn new(stack: usize, p: Box<dyn FnBox()>)
                           -> io::Result<Thread> {
         let p = box p;
 
@@ -42,7 +43,8 @@ pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
         let stack_size = (stack + 0xfffe) & (!0xfffe);
         let ret = c::CreateThread(ptr::null_mut(), stack_size,
                                   thread_start, &*p as *const _ as *mut _,
-                                  0, ptr::null_mut());
+                                  c::STACK_SIZE_PARAM_IS_A_RESERVATION,
+                                  ptr::null_mut());
 
         return if ret as usize == 0 {
             Err(io::Error::last_os_error())