@@ -30,9 +30,11 @@ use task;
30
30
use bookeeping;
31
31
32
32
/// 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 {
34
34
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 ) ;
36
38
return task;
37
39
}
38
40
@@ -41,7 +43,8 @@ fn ops() -> ~Ops {
41
43
lock : unsafe { Mutex :: new ( ) } ,
42
44
awoken : false ,
43
45
io : io:: IoFactory :: new ( ) ,
44
- stack_bounds : None ,
46
+ // these *should* get overwritten
47
+ stack_bounds : ( 0 , 0 ) ,
45
48
}
46
49
}
47
50
@@ -95,7 +98,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
95
98
stack:: record_stack_bounds ( my_stack - stack + 1024 , my_stack) ;
96
99
}
97
100
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) ;
99
102
100
103
let mut f = Some ( f) ;
101
104
let mut task = task;
@@ -115,7 +118,7 @@ struct Ops {
115
118
// This field holds the known bounds of the stack in (lo, hi) form. Not all
116
119
// native tasks necessarily know their precise bounds, hence this is
117
120
// optional.
118
- stack_bounds : Option < ( uint , uint ) > ,
121
+ stack_bounds : ( uint , uint ) ,
119
122
}
120
123
121
124
impl rt:: Runtime for Ops {
@@ -137,7 +140,7 @@ impl rt::Runtime for Ops {
137
140
self as ~Any
138
141
}
139
142
140
- fn stack_bounds ( & self ) -> Option < ( uint , uint ) > { self . stack_bounds }
143
+ fn stack_bounds ( & self ) -> ( uint , uint ) { self . stack_bounds }
141
144
142
145
// This function gets a little interesting. There are a few safety and
143
146
// ownership violations going on here, but this is all done in the name of
0 commit comments