Closed caobug closed 2 years ago
You need to run your code in an async function, like:
#[tokio::main]
async fn main() {
let limit = /* your set up limiter */;
limit.acquire(8192).await;
// this will happen after the limit has been acquired.
}
Hello, I tried adding
limit.acquire(8192).await;
to "copy.rs poll" but it always prompts me "only allowed inside async functions and blocks", which I know means what.So I modified some code, but it seems that cx.wake is never called. what should I do to make it work properly.?
Add to here:
https://github.com/tokio-rs/tokio/blob/d32ba2cf9d9b7eac3a904f558e5fe4397cc83e89/tokio/src/io/util/copy.rs#L91