about summary refs log tree commit diff
path: root/src/libstd/task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/task.rs')
-rw-r--r--src/libstd/task.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/task.rs b/src/libstd/task.rs
index 6881a1adb25..13395fc9c76 100644
--- a/src/libstd/task.rs
+++ b/src/libstd/task.rs
@@ -12,8 +12,11 @@
 
 #![deprecated = "use std::thread instead"]
 
+use any::Any;
+use boxed::Box;
 use thread;
 use kinds::Send;
+use result::Result;
 
 /// Deprecate: use `std::thread::Cfg` instead.
 #[deprecated = "use std::thread::Cfg instead"]
@@ -24,3 +27,15 @@ pub type TaskBuilder = thread::Cfg;
 pub fn spawn(f: proc(): Send) {
     thread::Thread::spawn(f);
 }
+
+/// Deprecated: use `std::thread::Thread::with_join instead`.
+#[deprecated = "use std::thread::Thread::with_join instead"]
+pub fn try<T: Send>(f: proc(): Send -> T) -> Result<T, Box<Any + Send>> {
+    thread::Thread::with_join(f).join()
+}
+
+/// Deprecated: use `std::thread::Thread::yield_now instead`.
+#[deprecated = "use std::thread::Thread::yield_now instead"]
+pub fn deschedule() {
+    thread::Thread::yield_now()
+}