std: Remove ManualThreads spawn mode
This commit is contained in:
@@ -890,7 +890,7 @@ mod tests {
|
|||||||
fn test_sem_runtime_friendly_blocking() {
|
fn test_sem_runtime_friendly_blocking() {
|
||||||
// Force the runtime to schedule two threads on the same sched_loop.
|
// Force the runtime to schedule two threads on the same sched_loop.
|
||||||
// When one blocks, it should schedule the other one.
|
// When one blocks, it should schedule the other one.
|
||||||
do task::spawn_sched(task::ManualThreads(1)) {
|
do task::spawn_sched(task::SingleThreaded) {
|
||||||
let s = ~Semaphore::new(1);
|
let s = ~Semaphore::new(1);
|
||||||
let s2 = ~s.clone();
|
let s2 = ~s.clone();
|
||||||
let (p,c) = comm::stream();
|
let (p,c) = comm::stream();
|
||||||
|
|||||||
@@ -107,8 +107,6 @@ pub enum SchedMode {
|
|||||||
SingleThreaded,
|
SingleThreaded,
|
||||||
/// Tasks are distributed among available CPUs
|
/// Tasks are distributed among available CPUs
|
||||||
ThreadPerTask,
|
ThreadPerTask,
|
||||||
/// Tasks are distributed among a fixed number of OS threads
|
|
||||||
ManualThreads(uint),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -932,13 +930,6 @@ fn test_try_fail() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[should_fail]
|
|
||||||
#[ignore(cfg(windows))]
|
|
||||||
fn test_spawn_sched_no_threads() {
|
|
||||||
do spawn_sched(ManualThreads(0u)) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_spawn_sched() {
|
fn test_spawn_sched() {
|
||||||
let (po, ch) = stream::<()>();
|
let (po, ch) = stream::<()>();
|
||||||
@@ -1219,34 +1210,6 @@ fn test_child_doesnt_ref_parent() {
|
|||||||
task::spawn(child_no(0));
|
task::spawn(child_no(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[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]
|
#[test]
|
||||||
fn test_simple_newsched_spawn() {
|
fn test_simple_newsched_spawn() {
|
||||||
use rt::test::run_in_newsched_task;
|
use rt::test::run_in_newsched_task;
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ extern {
|
|||||||
|
|
||||||
pub fn rust_get_sched_id() -> sched_id;
|
pub fn rust_get_sched_id() -> sched_id;
|
||||||
pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
|
pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
|
||||||
pub fn rust_sched_threads() -> libc::size_t;
|
|
||||||
pub fn rust_sched_current_nonlazy_threads() -> libc::size_t;
|
|
||||||
|
|
||||||
pub fn get_task_id() -> task_id;
|
pub fn get_task_id() -> task_id;
|
||||||
#[rust_stack]
|
#[rust_stack]
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ use local_data;
|
|||||||
use task::local_data_priv::{local_get, local_set, OldHandle};
|
use task::local_data_priv::{local_get, local_set, OldHandle};
|
||||||
use task::rt::rust_task;
|
use task::rt::rust_task;
|
||||||
use task::rt;
|
use task::rt;
|
||||||
use task::{Failure, ManualThreads, PlatformThread, SchedOpts, SingleThreaded};
|
use task::{Failure, PlatformThread, SchedOpts, SingleThreaded};
|
||||||
use task::{Success, TaskOpts, TaskResult, ThreadPerTask};
|
use task::{Success, TaskOpts, TaskResult, ThreadPerTask};
|
||||||
use task::{ExistingScheduler, SchedulerHandle};
|
use task::{ExistingScheduler, SchedulerHandle};
|
||||||
use task::unkillable;
|
use task::unkillable;
|
||||||
@@ -814,12 +814,6 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) {
|
|||||||
ThreadPerTask => {
|
ThreadPerTask => {
|
||||||
fail!("ThreadPerTask scheduling mode unimplemented")
|
fail!("ThreadPerTask scheduling mode unimplemented")
|
||||||
}
|
}
|
||||||
ManualThreads(threads) => {
|
|
||||||
if threads == 0u {
|
|
||||||
fail!("can not create a scheduler with no threads");
|
|
||||||
}
|
|
||||||
threads
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
@@ -549,18 +549,6 @@ start_task(rust_task *target, fn_env_pair *f) {
|
|||||||
target->start(f->f, f->env, NULL);
|
target->start(f->f, f->env, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CDECL size_t
|
|
||||||
rust_sched_current_nonlazy_threads() {
|
|
||||||
rust_task *task = rust_get_current_task();
|
|
||||||
return task->sched->number_of_threads();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" CDECL size_t
|
|
||||||
rust_sched_threads() {
|
|
||||||
rust_task *task = rust_get_current_task();
|
|
||||||
return task->sched->max_number_of_threads();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is called by an intrinsic on the Rust stack and must run
|
// This is called by an intrinsic on the Rust stack and must run
|
||||||
// entirely in the red zone. Do not call on the C stack.
|
// entirely in the red zone. Do not call on the C stack.
|
||||||
extern "C" CDECL MUST_CHECK bool
|
extern "C" CDECL MUST_CHECK bool
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ rust_log_console_off
|
|||||||
rust_should_log_console
|
rust_should_log_console
|
||||||
rust_set_environ
|
rust_set_environ
|
||||||
rust_unset_sigprocmask
|
rust_unset_sigprocmask
|
||||||
rust_sched_current_nonlazy_threads
|
|
||||||
rust_sched_threads
|
|
||||||
rust_set_exit_status
|
rust_set_exit_status
|
||||||
rust_start
|
rust_start
|
||||||
rust_env_pairs
|
rust_env_pairs
|
||||||
|
|||||||
Reference in New Issue
Block a user