@@ -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
@@ -91,7 +94,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
91
94
stack:: record_stack_bounds ( my_stack - stack + 1024 , my_stack) ;
92
95
}
93
96
let mut ops = ops;
94
- ops. stack_bounds = Some ( ( my_stack - stack + 1024 , my_stack) ) ;
97
+ ops. stack_bounds = ( my_stack - stack + 1024 , my_stack) ;
95
98
96
99
let mut f = Some ( f) ;
97
100
let mut task = task;
@@ -111,7 +114,7 @@ struct Ops {
111
114
// This field holds the known bounds of the stack in (lo, hi) form. Not all
112
115
// native tasks necessarily know their precise bounds, hence this is
113
116
// optional.
114
- stack_bounds : Option < ( uint , uint ) > ,
117
+ stack_bounds : ( uint , uint ) ,
115
118
}
116
119
117
120
impl rt:: Runtime for Ops {
@@ -133,7 +136,7 @@ impl rt::Runtime for Ops {
133
136
self as ~Any
134
137
}
135
138
136
- fn stack_bounds ( & self ) -> Option < ( uint , uint ) > { self . stack_bounds }
139
+ fn stack_bounds ( & self ) -> ( uint , uint ) { self . stack_bounds }
137
140
138
141
// This function gets a little interesting. There are a few safety and
139
142
// ownership violations going on here, but this is all done in the name of
0 commit comments