@@ -46,8 +46,7 @@ native mod rustrt {
46
46
fn get_port_id ( po : * rust_port ) -> port_id ;
47
47
fn rust_port_size ( po : * rust_port ) -> ctypes:: size_t ;
48
48
fn port_recv ( dptr : * uint , po : * rust_port ,
49
- yield : * ctypes:: uintptr_t ,
50
- killed : * ctypes:: uintptr_t ) ;
49
+ yield : * ctypes:: uintptr_t ) ;
51
50
fn rust_port_select ( dptr : * * rust_port , ports : * * rust_port ,
52
51
n_ports : ctypes:: size_t ,
53
52
yield : * ctypes:: uintptr_t ) ;
@@ -142,21 +141,19 @@ fn recv_<T: send>(p: *rust_port) -> T {
142
141
// that will grab the value of the return pointer, then call this
143
142
// function, which we will then use to call the runtime.
144
143
fn recv ( dptr : * uint , port : * rust_port ,
145
- yield : * ctypes:: uintptr_t ,
146
- killed : * ctypes:: uintptr_t ) unsafe {
147
- rustrt:: port_recv ( dptr, port, yield , killed) ;
144
+ yield : * ctypes:: uintptr_t ) unsafe {
145
+ rustrt:: port_recv ( dptr, port, yield ) ;
148
146
}
149
147
let yield = 0 u;
150
148
let yieldp = ptr:: addr_of ( yield ) ;
151
- let killed = 0 u;
152
- let killedp = ptr:: addr_of ( killed) ;
153
- let res = rusti:: call_with_retptr ( bind recv ( _, p, yieldp, killedp) ) ;
154
- if killed != 0 u {
155
- fail "killed" ;
156
- }
149
+ let res = rusti:: call_with_retptr ( bind recv ( _, p, yieldp) ) ;
157
150
if yield != 0 u {
158
151
// Data isn't available yet, so res has not been initialized.
159
152
task:: yield ( ) ;
153
+ } else {
154
+ // In the absense of compiler-generated preemption points
155
+ // this is a good place to yield
156
+ task:: yield ( ) ;
160
157
}
161
158
ret res;
162
159
}
@@ -186,6 +183,10 @@ fn select2<A: send, B: send>(
186
183
if yield != 0 u {
187
184
// Wait for data
188
185
task:: yield ( ) ;
186
+ } else {
187
+ // As in recv, this is a good place to yield anyway until
188
+ // the compiler generates yield calls
189
+ task:: yield ( ) ;
189
190
}
190
191
191
192
// Now we know the port we're supposed to receive from
0 commit comments