MCPcopy Create free account
hub / github.com/aws/clock-bound / cancel_safety

Function cancel_safety

clock-bound/src/daemon/async_ring_buffer.rs:386–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384
385 #[tokio::test]
386 async fn cancel_safety() {
387 let (tx, rx) = create(2);
388 tx.send(1).unwrap();
389
390 tokio::select! {
391 biased;
392 _ = async {} => {
393 // The empty branch should complete first
394 }
395 _ = rx.recv() => {
396 panic!("This branch should not complete first");
397 }
398 }
399
400 // The value should still be available
401 assert_eq!(rx.recv().await.unwrap(), 1);
402 }
403
404 // nothing async, but needs tokio runtime due to inner notify
405 #[tokio::test]

Callers

nothing calls this directly

Calls 2

createFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected