We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 240cf90 + c340409 commit 01738d1Copy full SHA for 01738d1
crossbeam-channel/tests/golang.rs
@@ -314,6 +314,33 @@ mod fifo {
314
}
315
316
317
+// https://github.com/golang/go/blob/master/test/chan/goroutines.go
318
+mod goroutines {
319
+ use super::*;
320
+
321
+ fn f(left: Chan<i32>, right: Chan<i32>) {
322
+ left.send(right.recv().unwrap());
323
+ }
324
325
+ #[test]
326
+ fn main() {
327
+ let n = 10_000i32;
328
329
+ let leftmost = make::<i32>(0);
330
+ let mut right = leftmost.clone();
331
+ let mut left = leftmost.clone();
332
333
+ for _ in 0..n {
334
+ right = make::<i32>(0);
335
+ go!(left, right, f(left, right));
336
+ left = right.clone();
337
338
339
+ go!(right, right.send(1));
340
+ leftmost.recv().unwrap();
341
342
+}
343
344
// https://github.com/golang/go/blob/master/test/chan/nonblock.go
345
mod nonblock {
346
use super::*;
0 commit comments