This library provide a map associated blocking primitive that waiting for a response produced by another coroutine
the map associated interface is through WaiterMap
```rust
fn testwaitermap() {
let reqmap = Arc::new(WaiterMap::
let key = 1234;
// one coroutine wait data send from another coroutine // prepare the waiter first let waiter = reqmap.newwaiter(key);
// trigger the rsp in another coroutine go!(move || reqmap1.set_rsp(&key, 100).ok());
// this will block until the rsp was set let result = waiter.waitrsp(None).unwrap(); asserteq!(result, 100); } ```
the token associated interface is through TokenWaiter
, which not need a map
```rust
fn testtokenwaiter() {
for j in 0..100 {
let result = go!(move || {
let waiter = TokenWaiter::
assert_eq!(result, j);
} } ```