From 2d45fab9f36110de95a4e91e78c546c44e82a306 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 22 Oct 2021 20:00:02 -0600 Subject: [PATCH] impl Send and Sync for IoVec --- CHANGELOG.md | 2 ++ src/sys/uio.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f06dd648..63bb744098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Added `fexecve` on DragonFly. (#[1577](https://github.com/nix-rust/nix/pull/1577)) +- `sys::uio::IoVec` is now `Send` and `Sync` + (#[1582](https://github.com/nix-rust/nix/pull/1582)) - Added fine-grained features flags. Most Nix functionality can now be conditionally enabled. By default, all features are enabled. (#[1611](https://github.com/nix-rust/nix/pull/1611)) diff --git a/src/sys/uio.rs b/src/sys/uio.rs index 523240200f..125c2e6c30 100644 --- a/src/sys/uio.rs +++ b/src/sys/uio.rs @@ -228,3 +228,8 @@ impl<'a> IoVec<&'a mut [u8]> { }, PhantomData) } } + +// The only reason IoVec isn't automatically Send+Sync is because libc::iovec +// contains raw pointers. +unsafe impl Send for IoVec where T: Send {} +unsafe impl Sync for IoVec where T: Sync {}