mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
f1444aaf72
Pointers in rust don't implement Send or Sync and so any struct that contains a raw pointer doesn't implement those traits either. However, there's nothing inherently unsafe about sending a pointer across thread boundaries. The only unsafety comes from actually de-referencing the pointer, which already requires an unsafe block. Explicitly implement Send + Sync for IoSliceMut since the iovec internally holds a *mut c_void, which prevents those traits from being auto-implemented. Send + Sync is also implemented by std::io::IoSliceMut, which is almost exactly the same as our IoSliceMut, so that can provide some additional reassurance that this is safe. Also add a missing copyright header in the file. BUG=none TEST=unit tests Change-Id: Ic21fc0de9b29923420f36ab166fec80d4d4cf2e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2571146 Reviewed-by: Noah Gold <nkgold@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |