@@ -29,10 +29,11 @@ use io;
2929use std:: task:: { TaskBuilder , Spawner } ;
3030
3131/// Creates a new Task which is ready to execute as a 1:1 task.
32- pub fn new ( stack_bounds : ( uint , uint ) ) -> Box < Task > {
32+ pub fn new ( stack_bounds : ( uint , uint ) , stack_guard : uint ) -> Box < Task > {
3333 let mut task = box Task :: new ( ) ;
3434 let mut ops = ops ( ) ;
3535 ops. stack_bounds = stack_bounds;
36+ ops. stack_guard = stack_guard;
3637 task. put_runtime ( ops) ;
3738 return task;
3839}
@@ -44,6 +45,7 @@ fn ops() -> Box<Ops> {
4445 io : io:: IoFactory :: new ( ) ,
4546 // these *should* get overwritten
4647 stack_bounds : ( 0 , 0 ) ,
48+ stack_guard : 0
4749 }
4850}
4951
@@ -82,6 +84,7 @@ impl Spawner for NativeSpawner {
8284 my_stack) ;
8385 }
8486 let mut ops = ops;
87+ ops. stack_guard = rt:: thread:: current_guard_page ( ) ;
8588 ops. stack_bounds = ( my_stack - stack + 1024 , my_stack) ;
8689
8790 let mut f = Some ( f) ;
@@ -115,6 +118,8 @@ struct Ops {
115118 // native tasks necessarily know their precise bounds, hence this is
116119 // optional.
117120 stack_bounds : ( uint , uint ) ,
121+
122+ stack_guard : uint
118123}
119124
120125impl rt:: Runtime for Ops {
@@ -138,6 +143,14 @@ impl rt::Runtime for Ops {
138143
139144 fn stack_bounds ( & self ) -> ( uint , uint ) { self . stack_bounds }
140145
146+ fn stack_guard ( & self ) -> Option < uint > {
147+ if self . stack_guard != 0 {
148+ Some ( self . stack_guard )
149+ } else {
150+ None
151+ }
152+ }
153+
141154 fn can_block ( & self ) -> bool { true }
142155
143156 // This function gets a little interesting. There are a few safety and
0 commit comments