2013-05-30 05:16:33 -05:00
|
|
|
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
2012-12-03 18:48:01 -06:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2014-11-25 10:52:10 -06:00
|
|
|
//! Deprecated in favor of `thread`.
|
2012-11-18 19:56:50 -06:00
|
|
|
|
2014-11-25 10:52:10 -06:00
|
|
|
#![deprecated = "use std::thread instead"]
|
2014-06-30 19:22:40 -05:00
|
|
|
|
2014-12-06 20:34:37 -06:00
|
|
|
use any::Any;
|
|
|
|
use boxed::Box;
|
2014-11-25 10:52:10 -06:00
|
|
|
use thread;
|
2014-12-13 22:06:44 -06:00
|
|
|
use kinds::Send;
|
2014-12-06 20:34:37 -06:00
|
|
|
use result::Result;
|
2014-12-14 02:05:32 -06:00
|
|
|
use ops::FnOnce;
|
2012-11-18 19:56:50 -06:00
|
|
|
|
2014-12-14 02:05:32 -06:00
|
|
|
/// Deprecate: use `std::thread::Builder` instead.
|
|
|
|
#[deprecated = "use std::thread::Builder instead"]
|
|
|
|
pub type TaskBuilder = thread::Builder;
|
2014-06-17 16:48:54 -05:00
|
|
|
|
2014-12-14 02:05:32 -06:00
|
|
|
/// Deprecated: use `std::thread::Thread::spawn` and `detach` instead.
|
|
|
|
#[deprecated = "use std::thread::Thread::spawn and detach instead"]
|
|
|
|
pub fn spawn<F>(f: F) where F: FnOnce(), F: Send {
|
|
|
|
thread::Thread::spawn(f).detach();
|
2014-06-13 18:03:41 -05:00
|
|
|
}
|
2014-12-06 20:34:37 -06:00
|
|
|
|
2014-12-14 02:05:32 -06:00
|
|
|
/// Deprecated: use `std::thread::Thread::spawn` and `join` instead.
|
|
|
|
#[deprecated = "use std::thread::Thread::spawn and join instead"]
|
|
|
|
pub fn try<T, F>(f: F) -> Result<T, Box<Any + Send>> where
|
|
|
|
T: Send, F: FnOnce() -> T, F: Send
|
|
|
|
{
|
|
|
|
thread::Thread::spawn(f).join()
|
2014-12-06 20:34:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Deprecated: use `std::thread::Thread::yield_now instead`.
|
|
|
|
#[deprecated = "use std::thread::Thread::yield_now instead"]
|
|
|
|
pub fn deschedule() {
|
|
|
|
thread::Thread::yield_now()
|
|
|
|
}
|