]> git.lizzy.rs Git - rust.git/blob - src/libstd/task.rs
doc: remove incomplete sentence
[rust.git] / src / libstd / task.rs
1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Deprecated in favor of `thread`.
12
13 #![deprecated = "use std::thread instead"]
14
15 use any::Any;
16 use boxed::Box;
17 use thread;
18 use kinds::Send;
19 use result::Result;
20 use ops::FnOnce;
21
22 /// Deprecate: use `std::thread::Builder` instead.
23 #[deprecated = "use std::thread::Builder instead"]
24 pub type TaskBuilder = thread::Builder;
25
26 /// Deprecated: use `std::thread::Thread::spawn` and `detach` instead.
27 #[deprecated = "use std::thread::Thread::spawn and detach instead"]
28 pub fn spawn<F>(f: F) where F: FnOnce(), F: Send {
29     thread::Thread::spawn(f).detach();
30 }
31
32 /// Deprecated: use `std::thread::Thread::spawn` and `join` instead.
33 #[deprecated = "use std::thread::Thread::spawn and join instead"]
34 pub fn try<T, F>(f: F) -> Result<T, Box<Any + Send>> where
35     T: Send, F: FnOnce() -> T, F: Send
36 {
37     thread::Thread::spawn(f).join()
38 }
39
40 /// Deprecated: use `std::thread::Thread::yield_now instead`.
41 #[deprecated = "use std::thread::Thread::yield_now instead"]
42 pub fn deschedule() {
43     thread::Thread::yield_now()
44 }