Skip to content

Commit e88894d

Browse files
committed
---
yaml --- r: 22566 b: refs/heads/master c: 436d263 h: refs/heads/master v: v3
1 parent cc88e0c commit e88894d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0487663e7d9d7b542a66299dee64204f8c96689c
2+
refs/heads/master: 436d263aed2ef54cdcec84ecb9c99a71b487769e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/pipes.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,22 @@ fn select2<A: send, B: send>(
318318
}
319319
}
320320

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 {
322326
wait_many(endpoints.map(|p| p.header()))
323327
}
324328

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+
325337
#[doc = "Waits on a set of endpoints. Returns a message, its index,
326338
and a list of the remaining endpoints."]
327339
fn select<T: send>(+endpoints: ~[recv_packet<T>])
@@ -552,7 +564,7 @@ class port_set<T: send> {
552564
}
553565
}
554566

555-
impl private_methods/&<T: send> for pipes::port<T> {
567+
impl<T: send> of selectable for pipes::port<T> {
556568
pure fn header() -> *pipes::packet_header unchecked {
557569
alt self.endp {
558570
some(endp) {

0 commit comments

Comments
 (0)