Skip to content

Commit ed6636b

Browse files
committed
---
yaml --- r: 29778 b: refs/heads/incoming c: 2ac2883 h: refs/heads/master v: v3
1 parent 09fb002 commit ed6636b

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 4ec1dd991405404725b5cc448295dc0be9cd17e5
9+
refs/heads/incoming: 2ac288383d22e8c4a18561293cfddd64a48e7b38
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/pipes.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,16 +1144,22 @@ proto! oneshot {
11441144
}
11451145
}
11461146

1147-
/// Receive a message from a oneshot pipe.
1147+
/// Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair.
1148+
fn oneshot<T: send>() -> (oneshot::client::oneshot<T>,
1149+
oneshot::server::oneshot<T>) {
1150+
oneshot::init()
1151+
}
1152+
1153+
/**
1154+
* Receive a message from a oneshot pipe, failing if the connection was
1155+
* closed.
1156+
*/
11481157
fn recv_one<T: send>(+port: oneshot::server::oneshot<T>) -> T {
11491158
let oneshot::send(message) = recv(port);
11501159
message
11511160
}
11521161

1153-
/** Receive a message from a oneshot pipe, or fail if the connection
1154-
is closed.
1155-
1156-
*/
1162+
/// Receive a message from a oneshot pipe unless the connection was closed.
11571163
fn try_recv_one<T: send> (+port: oneshot::server::oneshot<T>) -> option<T> {
11581164
let message = try_recv(port);
11591165

@@ -1164,6 +1170,20 @@ fn try_recv_one<T: send> (+port: oneshot::server::oneshot<T>) -> option<T> {
11641170
}
11651171
}
11661172

1173+
/// Send a message on a oneshot pipe, failing if the connection was closed.
1174+
fn send_one<T: send>(+chan: oneshot::client::oneshot<T>, +data: T) {
1175+
oneshot::client::send(chan, data);
1176+
}
1177+
1178+
/**
1179+
* Send a message on a oneshot pipe, or return false if the connection was
1180+
* closed.
1181+
*/
1182+
fn try_send_one<T: send>(+chan: oneshot::client::oneshot<T>, +data: T)
1183+
-> bool {
1184+
oneshot::client::try_send(chan, data).is_some()
1185+
}
1186+
11671187
#[cfg(test)]
11681188
mod test {
11691189
#[test]

0 commit comments

Comments
 (0)