From 1b6a9b3d7cb4f1593dce2a78d57e9a094e876860 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 | 3 +++ src/sys/uio.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d935e28c5d..3ff97b0828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] - ReleaseDate ### Added +- `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 {}