crosvm/cros_async
Daniel Verkamp 3e8054ee7c base: unix: merge EpollContext into PollContext
The main distinction between PollContext and EpollContext was that the
latter was safe to use from multiple threads. This was not true of the
more widely-used PollContext for two reasons:

1. The `events` array was stored inside the `PollContext` structure,
   whereas `EpollContext` required the caller to pass their own storage
   for events.
2. `PollContext` had a hangup detection feature used to debug busy
   looping cases that result from a failure to remove hungup file
   descriptors from the context.

Point 1 is resolved by returning a `SmallVec` of events that avoids
allocation for the normal case (and in fact it should avoid allocation
in all cases on Linux, where the maximum number of events returned from
a single `epoll_wait()` call is limited to the same size as the
preallocated `SmallVec`). This simplifies the API and also means that
there is no need for per-context storage.

Point 2 can't easily be resolved, since it would require the `wait` call
to mutate shared state (this could be done by adding a mutex around the
shared data, but that seems like too much overhead for the value of the
feature). Instead, this patch just removes the hangup detection code.

BUG=b:213153157
TEST=tools/dev_container tools/presubmit --all

Change-Id: Ia48c46de96976da27cb5387e3e5e8fcf92d0e85b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3633111
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-02 21:44:39 +00:00
..
src
Cargo.toml