Understanding documentation of `AsyncFd` (in particular `AsyncFdReadyGurad`)

⚓ Rust    📅 2025-12-31    👤 surdeus    👁️ 5      

surdeus

AsyncFd::ready returns an AsyncFdReadyGuard which is documented to be (emphasis mine)

returning a AsyncFdReadyGuard that must be dropped to resume polling for the requested ready states.

I think I understand the gist of the API: clear R/W readiness on the tokio side iff we did encounter R/W EWOULDBLOCK. What I don't understand is why the doc explicitly mentions the guard must be dropped to resume polling. The guard has no impl Drop and no further drop glue seems to be associated with it, so it seems to me nothing special is happening when it goes out of scope? I mean at the same time we do know that we may in fact manipulate AsyncFd in parallel:

Any number of tasks can query the same AsyncFd in parallel, on the same or different conditions.

Which seems to suggest that AsyncFd does not actually care how many AsyncFdReadyGuard exists out there anyway?

1 post - 1 participant

Read full topic

🏷️ Rust_feed