about summary refs log tree commit diff
path: root/src/libstd/task
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/task')
-rw-r--r--src/libstd/task/mod.rs12
-rw-r--r--src/libstd/task/spawn.rs14
2 files changed, 15 insertions, 11 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs
index 225a4b8cfd2..4b5543b8186 100644
--- a/src/libstd/task/mod.rs
+++ b/src/libstd/task/mod.rs
@@ -142,7 +142,8 @@ pub struct TaskOpts {
     indestructible: bool,
     notify_chan: Option<Chan<TaskResult>>,
     name: Option<~str>,
-    sched: SchedOpts
+    sched: SchedOpts,
+    stack_size: Option<uint>
 }
 
 /**
@@ -197,7 +198,8 @@ impl TaskBuilder {
                 indestructible: self.opts.indestructible,
                 notify_chan: notify_chan,
                 name: name,
-                sched: self.opts.sched
+                sched: self.opts.sched,
+                stack_size: self.opts.stack_size
             },
             gen_body: gen_body,
             can_not_copy: None,
@@ -351,7 +353,8 @@ impl TaskBuilder {
             indestructible: x.opts.indestructible,
             notify_chan: notify_chan,
             name: name,
-            sched: x.opts.sched
+            sched: x.opts.sched,
+            stack_size: x.opts.stack_size
         };
         let f = match gen_body {
             Some(gen) => {
@@ -422,7 +425,8 @@ pub fn default_task_opts() -> TaskOpts {
         name: None,
         sched: SchedOpts {
             mode: DefaultScheduler,
-        }
+        },
+        stack_size: None
     }
 }
 
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs
index 7486a78837c..2d0a2d98e9f 100644
--- a/src/libstd/task/spawn.rs
+++ b/src/libstd/task/spawn.rs
@@ -713,9 +713,9 @@ fn spawn_raw_newsched(mut opts: TaskOpts, f: ~fn()) {
     let mut task = unsafe {
         if opts.sched.mode != SingleThreaded {
             if opts.watched {
-                Task::build_child(child_wrapper)
+                Task::build_child(opts.stack_size, child_wrapper)
             } else {
-                Task::build_root(child_wrapper)
+                Task::build_root(opts.stack_size, child_wrapper)
             }
         } else {
             // Creating a 1:1 task:thread ...
@@ -736,16 +736,16 @@ fn spawn_raw_newsched(mut opts: TaskOpts, f: ~fn()) {
 
             // Pin the new task to the new scheduler
             let new_task = if opts.watched {
-                Task::build_homed_child(child_wrapper, Sched(new_sched_handle))
+                Task::build_homed_child(opts.stack_size, child_wrapper, Sched(new_sched_handle))
             } else {
-                Task::build_homed_root(child_wrapper, Sched(new_sched_handle))
+                Task::build_homed_root(opts.stack_size, child_wrapper, Sched(new_sched_handle))
             };
 
             // Create a task that will later be used to join with the new scheduler
             // thread when it is ready to terminate
             let (thread_port, thread_chan) = oneshot();
             let thread_port_cell = Cell::new(thread_port);
-            let join_task = do Task::build_child() {
+            let join_task = do Task::build_child(None) {
                 rtdebug!("running join task");
                 let thread_port = thread_port_cell.take();
                 let thread: Thread = thread_port.recv();
@@ -762,8 +762,8 @@ fn spawn_raw_newsched(mut opts: TaskOpts, f: ~fn()) {
                 let mut orig_sched_handle = orig_sched_handle_cell.take();
                 let join_task = join_task_cell.take();
 
-                let bootstrap_task = ~do Task::new_root(&mut new_sched.stack_pool) || {
-                    rtdebug!("bootstrapping a 1:1 scheduler");
+                let bootstrap_task = ~do Task::new_root(&mut new_sched.stack_pool, None) || {
+                    rtdebug!("boostrapping a 1:1 scheduler");
                 };
                 new_sched.bootstrap(bootstrap_task);