diff options
| author | bors <bors@rust-lang.org> | 2013-07-31 02:10:24 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-07-31 02:10:24 -0700 |
| commit | 8b7e241e02bb9f82d7b931033afde477d03ff4f2 (patch) | |
| tree | 84f3b2d5a4f8f81f86b7a04ab937d4a0d18a8366 /src/libstd/task/mod.rs | |
| parent | 8a737b502067b1896686bd1f9df7a1446296d80b (diff) | |
| parent | 33df9fc1d04c224a0c7ecb8d91b75feed75b412c (diff) | |
auto merge of #8139 : brson/rust/rm-old-task-apis, r=pcwalton
This removes a bunch of options from the task builder interface that are irrelevant to the new scheduler and were generally unused anyway. It also bumps the stack size of new scheduler tasks so that there's enough room to run rustc and changes the interface to `Thread` to not implicitly join threads on destruction, but instead require an explicit, and mandatory, call to `join`.
Diffstat (limited to 'src/libstd/task/mod.rs')
| -rw-r--r-- | src/libstd/task/mod.rs | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index c26349b220d..6de0c78d00b 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -44,7 +44,6 @@ use result::Result; use result; use rt::{context, OldTaskContext, TaskContext}; use rt::local::Local; -use task::rt::{task_id, sched_id}; use unstable::finally::Finally; use util; @@ -58,18 +57,6 @@ mod local_data_priv; pub mod rt; pub mod spawn; -/// A handle to a scheduler -#[deriving(Eq)] -pub enum Scheduler { - SchedulerHandle(sched_id) -} - -/// A handle to a task -#[deriving(Eq)] -pub enum Task { - TaskHandle(task_id) -} - /** * Indicates the manner in which a task exited. * @@ -92,23 +79,8 @@ pub enum TaskResult { pub enum SchedMode { /// Run task on the default scheduler DefaultScheduler, - /// Run task on the current scheduler - CurrentScheduler, - /// Run task on a specific scheduler - ExistingScheduler(Scheduler), - /** - * Tasks are scheduled on the main OS thread - * - * The main OS thread is the thread used to launch the runtime which, - * in most cases, is the process's initial thread as created by the OS. - */ - PlatformThread, /// All tasks run in the same OS thread SingleThreaded, - /// Tasks are distributed among available CPUs - ThreadPerTask, - /// Tasks are distributed among a fixed number of OS threads - ManualThreads(uint), } /** @@ -118,17 +90,9 @@ pub enum SchedMode { * * * sched_mode - The operating mode of the scheduler * - * * foreign_stack_size - The size of the foreign stack, in bytes - * - * Rust code runs on Rust-specific stacks. When Rust code calls foreign - * code (via functions in foreign modules) it switches to a typical, large - * stack appropriate for running code written in languages like C. By - * default these foreign stacks have unspecified size, but with this - * option their size can be precisely specified. */ pub struct SchedOpts { mode: SchedMode, - foreign_stack_size: Option<uint>, } /** @@ -446,7 +410,6 @@ pub fn default_task_opts() -> TaskOpts { notify_chan: None, sched: SchedOpts { mode: DefaultScheduler, - foreign_stack_size: None } } } @@ -591,18 +554,6 @@ pub fn failing() -> bool { } } -pub fn get_task() -> Task { - //! Get a handle to the running task - - unsafe { - TaskHandle(rt::get_task_id()) - } -} - -pub fn get_scheduler() -> Scheduler { - SchedulerHandle(unsafe { rt::rust_get_sched_id() }) -} - /** * Temporarily make the task unkillable * @@ -935,13 +886,6 @@ fn test_try_fail() { } #[test] -#[should_fail] -#[ignore(cfg(windows))] -fn test_spawn_sched_no_threads() { - do spawn_sched(ManualThreads(0u)) { } -} - -#[test] fn test_spawn_sched() { let (po, ch) = stream::<()>(); let ch = SharedChan::new(ch); @@ -1108,17 +1052,6 @@ fn test_avoid_copying_the_body_unlinked() { } #[test] -fn test_platform_thread() { - let (po, ch) = stream(); - let mut builder = task(); - builder.sched_mode(PlatformThread); - do builder.spawn { - ch.send(()); - } - po.recv(); -} - -#[test] #[ignore(cfg(windows))] #[should_fail] fn test_unkillable() { @@ -1222,34 +1155,6 @@ fn test_child_doesnt_ref_parent() { } #[test] -fn test_spawn_thread_on_demand() { - let (port, chan) = comm::stream(); - - do spawn_sched(ManualThreads(2)) || { - unsafe { - let max_threads = rt::rust_sched_threads(); - assert_eq!(max_threads as int, 2); - let running_threads = rt::rust_sched_current_nonlazy_threads(); - assert_eq!(running_threads as int, 1); - - let (port2, chan2) = comm::stream(); - - do spawn_sched(CurrentScheduler) || { - chan2.send(()); - } - - let running_threads2 = rt::rust_sched_current_nonlazy_threads(); - assert_eq!(running_threads2 as int, 2); - - port2.recv(); - chan.send(()); - } - } - - port.recv(); -} - -#[test] fn test_simple_newsched_spawn() { use rt::test::run_in_newsched_task; |
