File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -318,10 +318,22 @@ fn select2<A: send, B: send>(
318
318
}
319
319
}
320
320
321
- fn selecti < T : send > ( endpoints: & [ & recv_packet < T > ] ) -> uint {
321
+ trait selectable {
322
+ pure fn header( ) -> * packet_header;
323
+ }
324
+
325
+ fn selecti < T : selectable > ( endpoints: & [ T ] ) -> uint {
322
326
wait_many( endpoints. map( |p| p. header( ) ) )
323
327
}
324
328
329
+ fn select2i < A : selectable , B : selectable > ( a: A , b: B ) -> either < ( ) , ( ) > {
330
+ alt wait_many( [ a. header( ) , b. header( ) ] /_) {
331
+ 0 { left( ( ) ) }
332
+ 1 { right( ( ) ) }
333
+ _ { fail "wait returned unexpected index" }
334
+ }
335
+ }
336
+
325
337
#[ doc = "Waits on a set of endpoints. Returns a message, its index,
326
338
and a list of the remaining endpoints." ]
327
339
fn select < T : send > ( +endpoints: ~[ recv_packet < T > ] )
@@ -552,7 +564,7 @@ class port_set<T: send> {
552
564
}
553
565
}
554
566
555
- impl private_methods/ & <T : send> for pipes:: port<T > {
567
+ impl <T : send> of selectable for pipes:: port<T > {
556
568
pure fn header( ) -> * pipes:: packet_header unchecked {
557
569
alt self . endp {
558
570
some( endp) {
You can’t perform that action at this time.
0 commit comments