From bb9172d7b512c36f34d34b024640f030d1fde2eb Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 8 Mar 2014 18:21:49 -0800 Subject: Fix fallout of removing default bounds This is all purely fallout of getting the previous commit to compile. --- src/libstd/rt/thread.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/libstd/rt/thread.rs') diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs index 0cbd67557de..7c4bd895469 100644 --- a/src/libstd/rt/thread.rs +++ b/src/libstd/rt/thread.rs @@ -68,13 +68,13 @@ impl Thread<()> { /// to finish executing. This means that even if `join` is not explicitly /// called, when the `Thread` falls out of scope its destructor will block /// waiting for the OS thread. - pub fn start(main: proc() -> T) -> Thread { + pub fn start(main: proc:Send() -> T) -> Thread { Thread::start_stack(DEFAULT_STACK_SIZE, main) } /// Performs the same functionality as `start`, but specifies an explicit /// stack size for the new thread. - pub fn start_stack(stack: uint, main: proc() -> T) -> Thread { + pub fn start_stack(stack: uint, main: proc:Send() -> T) -> Thread { // We need the address of the packet to fill in to be stable so when // `main` fills it in it's still valid, so allocate an extra ~ box to do @@ -83,7 +83,7 @@ impl Thread<()> { let packet2: *mut Option = unsafe { *cast::transmute::<&~Option, **mut Option>(&packet) }; - let main: proc() = proc() unsafe { *packet2 = Some(main()); }; + let main = proc() unsafe { *packet2 = Some(main()); }; let native = unsafe { imp::create(stack, ~main) }; Thread { @@ -99,13 +99,13 @@ impl Thread<()> { /// This corresponds to creating threads in the 'detached' state on unix /// systems. Note that platforms may not keep the main program alive even if /// there are detached thread still running around. - pub fn spawn(main: proc()) { + pub fn spawn(main: proc:Send()) { Thread::spawn_stack(DEFAULT_STACK_SIZE, main) } /// Performs the same functionality as `spawn`, but explicitly specifies a /// stack size for the new thread. - pub fn spawn_stack(stack: uint, main: proc()) { + pub fn spawn_stack(stack: uint, main: proc:Send()) { unsafe { let handle = imp::create(stack, ~main); imp::detach(handle); @@ -146,6 +146,7 @@ impl Drop for Thread { mod imp { use cast; use cmp; + use kinds::Send; use libc; use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, SIZE_T, BOOL, LPVOID, DWORD, LPDWORD, HANDLE}; @@ -155,7 +156,7 @@ mod imp { pub type rust_thread = HANDLE; pub type rust_thread_return = DWORD; - pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread { + pub unsafe fn create(stack: uint, p: ~proc:Send()) -> rust_thread { let arg: *mut libc::c_void = cast::transmute(p); // FIXME On UNIX, we guard against stack sizes that are too small but // that's because pthreads enforces that stacks are at least @@ -203,6 +204,7 @@ mod imp { mod imp { use cast; use cmp; + use kinds::Send; use libc::consts::os::posix01::{PTHREAD_CREATE_JOINABLE, PTHREAD_STACK_MIN}; use libc; use mem; @@ -213,7 +215,7 @@ mod imp { pub type rust_thread = libc::pthread_t; pub type rust_thread_return = *u8; - pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread { + pub unsafe fn create(stack: uint, p: ~proc:Send()) -> rust_thread { let mut native: libc::pthread_t = mem::uninit(); let mut attr: libc::pthread_attr_t = mem::uninit(); assert_eq!(pthread_attr_init(&mut attr), 0); -- cgit 1.4.1-3-g733a5