@@ -30,9 +30,11 @@ use task;
3030use bookeeping;
3131
3232/// Creates a new Task which is ready to execute as a 1:1 task.
33- pub fn new ( ) -> ~Task {
33+ pub fn new ( stack_bounds : ( uint , uint ) ) -> ~Task {
3434 let mut task = ~Task :: new ( ) ;
35- task. put_runtime ( ops ( ) as ~rt:: Runtime ) ;
35+ let mut ops = ops ( ) ;
36+ ops. stack_bounds = stack_bounds;
37+ task. put_runtime ( ops as ~rt:: Runtime ) ;
3638 return task;
3739}
3840
@@ -41,7 +43,8 @@ fn ops() -> ~Ops {
4143 lock : unsafe { Mutex :: new ( ) } ,
4244 awoken : false ,
4345 io : io:: IoFactory :: new ( ) ,
44- stack_bounds : None ,
46+ // these *should* get overwritten
47+ stack_bounds : ( 0 , 0 ) ,
4548 }
4649}
4750
@@ -95,7 +98,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
9598 stack:: record_stack_bounds ( my_stack - stack + 1024 , my_stack) ;
9699 }
97100 let mut ops = ops;
98- ops. stack_bounds = Some ( ( my_stack - stack + 1024 , my_stack) ) ;
101+ ops. stack_bounds = ( my_stack - stack + 1024 , my_stack) ;
99102
100103 let mut f = Some ( f) ;
101104 let mut task = task;
@@ -115,7 +118,7 @@ struct Ops {
115118 // This field holds the known bounds of the stack in (lo, hi) form. Not all
116119 // native tasks necessarily know their precise bounds, hence this is
117120 // optional.
118- stack_bounds : Option < ( uint , uint ) > ,
121+ stack_bounds : ( uint , uint ) ,
119122}
120123
121124impl rt:: Runtime for Ops {
@@ -137,7 +140,7 @@ impl rt::Runtime for Ops {
137140 self as ~Any
138141 }
139142
140- fn stack_bounds ( & self ) -> Option < ( uint , uint ) > { self . stack_bounds }
143+ fn stack_bounds ( & self ) -> ( uint , uint ) { self . stack_bounds }
141144
142145 // This function gets a little interesting. There are a few safety and
143146 // ownership violations going on here, but this is all done in the name of
0 commit comments