summary refs log tree commit diff
path: root/src/libstd/task/spawn.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-31 02:10:24 -0700
committerbors <bors@rust-lang.org>2013-07-31 02:10:24 -0700
commit8b7e241e02bb9f82d7b931033afde477d03ff4f2 (patch)
tree84f3b2d5a4f8f81f86b7a04ab937d4a0d18a8366 /src/libstd/task/spawn.rs
parent8a737b502067b1896686bd1f9df7a1446296d80b (diff)
parent33df9fc1d04c224a0c7ecb8d91b75feed75b412c (diff)
downloadrust-8b7e241e02bb9f82d7b931033afde477d03ff4f2.tar.gz
rust-8b7e241e02bb9f82d7b931033afde477d03ff4f2.zip
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/spawn.rs')
-rw-r--r--src/libstd/task/spawn.rs37
1 files changed, 5 insertions, 32 deletions
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs
index 749db307012..54e46826976 100644
--- a/src/libstd/task/spawn.rs
+++ b/src/libstd/task/spawn.rs
@@ -84,9 +84,8 @@ use local_data;
 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, ThreadPerTask};
-use task::{ExistingScheduler, SchedulerHandle};
+use task::{Failure};
+use task::{Success, TaskOpts, TaskResult};
 use task::unkillable;
 use to_bytes::IterBytes;
 use uint;
@@ -747,7 +746,7 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) {
             // Create child task.
             let new_task = match opts.sched.mode {
                 DefaultScheduler => rt::new_task(),
-                _ => new_task_in_sched(opts.sched)
+                _ => new_task_in_sched()
             };
             assert!(!new_task.is_null());
             // Getting killed after here would leak the task.
@@ -805,35 +804,9 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) {
         return result;
     }
 
-    fn new_task_in_sched(opts: SchedOpts) -> *rust_task {
-        if opts.foreign_stack_size != None {
-            fail!("foreign_stack_size scheduler option unimplemented");
-        }
-
-        let num_threads = match opts.mode {
-            DefaultScheduler
-            | CurrentScheduler
-            | ExistingScheduler(*)
-            | PlatformThread => 0u, /* Won't be used */
-            SingleThreaded => 1u,
-            ThreadPerTask => {
-                fail!("ThreadPerTask scheduling mode unimplemented")
-            }
-            ManualThreads(threads) => {
-                if threads == 0u {
-                    fail!("can not create a scheduler with no threads");
-                }
-                threads
-            }
-        };
-
+    fn new_task_in_sched() -> *rust_task {
         unsafe {
-            let sched_id = match opts.mode {
-                CurrentScheduler => rt::rust_get_sched_id(),
-                ExistingScheduler(SchedulerHandle(id)) => id,
-                PlatformThread => rt::rust_osmain_sched_id(),
-                _ => rt::rust_new_sched(num_threads)
-            };
+            let sched_id = rt::rust_new_sched(1);
             rt::rust_new_task_in_sched(sched_id)
         }
     }