From 1dbcc8b188a88fe594da5157b9b61e6d9b3d0881 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 9 Jul 2013 17:44:28 -0700 Subject: [PATCH] std: Remove ThreadPerCore spawn mode. Unused --- src/libstd/task/mod.rs | 18 ------------------ src/libstd/task/rt.rs | 1 - src/libstd/task/spawn.rs | 3 +-- src/rt/rust_builtin.cpp | 6 ------ src/rt/rustrt.def.in | 1 - 5 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 5a3ff10ae83..caf28fb9b83 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -106,8 +106,6 @@ pub enum SchedMode { /// All tasks run in the same OS thread SingleThreaded, /// Tasks are distributed among available CPUs - ThreadPerCore, - /// Each task runs in its own OS thread ThreadPerTask, /// Tasks are distributed among a fixed number of OS threads ManualThreads(uint), @@ -1143,22 +1141,6 @@ fn test_child_doesnt_ref_parent() { task::spawn(child_no(0)); } -#[test] -fn test_sched_thread_per_core() { - let (port, chan) = comm::stream(); - - do spawn_sched(ThreadPerCore) || { - unsafe { - let cores = rt::rust_num_threads(); - let reported_threads = rt::rust_sched_threads(); - assert_eq!(cores as uint, reported_threads as uint); - chan.send(()); - } - } - - port.recv(); -} - #[test] fn test_spawn_thread_on_demand() { let (port, chan) = comm::stream(); diff --git a/src/libstd/task/rt.rs b/src/libstd/task/rt.rs index 4860ab36f77..714daae1752 100644 --- a/src/libstd/task/rt.rs +++ b/src/libstd/task/rt.rs @@ -38,7 +38,6 @@ pub extern { fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id; fn rust_sched_threads() -> libc::size_t; fn rust_sched_current_nonlazy_threads() -> libc::size_t; - fn rust_num_threads() -> libc::uintptr_t; fn get_task_id() -> task_id; #[rust_stack] diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index bcb7e06bf1f..2c2e7e9bc82 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -84,7 +84,7 @@ use task::local_data_priv::{local_get, local_set, OldHandle}; use task::rt::rust_task; use task::rt; use task::{Failure, ManualThreads, PlatformThread, SchedOpts, SingleThreaded}; -use task::{Success, TaskOpts, TaskResult, ThreadPerCore, ThreadPerTask}; +use task::{Success, TaskOpts, TaskResult, ThreadPerTask}; use task::{ExistingScheduler, SchedulerHandle}; use task::unkillable; use uint; @@ -745,7 +745,6 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) { | ExistingScheduler(*) | PlatformThread => 0u, /* Won't be used */ SingleThreaded => 1u, - ThreadPerCore => unsafe { rt::rust_num_threads() }, ThreadPerTask => { fail!("ThreadPerTask scheduling mode unimplemented") } diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 4a5fcf3c604..7cc3ce0f533 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -476,12 +476,6 @@ rust_get_sched_id() { return task->sched->get_id(); } -extern "C" CDECL uintptr_t -rust_num_threads() { - rust_task *task = rust_get_current_task(); - return task->kernel->env->num_sched_threads; -} - extern "C" CDECL int rust_get_argc() { rust_task *task = rust_get_current_task(); diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index ea614330866..3a9239812ea 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -28,7 +28,6 @@ rust_get_argc rust_get_argv rust_new_sched rust_new_task_in_sched -rust_num_threads rust_path_is_dir rust_path_exists rust_get_stdin