crosvm/cros_async
Chirantan Ekbote 4a86ce877a cros_async: Simplify uring executor drop impl
Closing the uring fd should release the resources borrowed by the kernel
so there's no reason to call io_uring_enter to drive any pending IO to
completion.  Doing so may end up blocking the thread indefinitely.

Instead just make sure that the URingContext is dropped before anything
else.  Rust's drop order guarantees that struct fields are dropped in
the order of declaration so this just means putting it first.

Also, since the RawExecutor is wrapped in an Arc it may end up being
dropped from a different thread than the one that called run() or
run_until().  We know there are no other references so just clear the
cached thread_id so that we don't panic in the drop impl.  We don't
currently have any users that want to run the executor concurrently on
multiple threads so we'll just punt that problem until we actually need
to deal with it.

BUG=none
TEST=unit tests

Change-Id: Icf6a23fc433128dd00adbd56a715dbae24cd8ea2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2643845
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-01-26 09:15:13 +00:00
..
src cros_async: Simplify uring executor drop impl 2021-01-26 09:15:13 +00:00
.build_test_skip
Cargo.toml