diff --git a/CHANGELOG.md b/CHANGELOG.md index 688d1be..9851279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - Updated the edition from 2018 to 2021. +- Implement `Send` and `Sync` for `Ftdi`. ## [0.32.0] - 2021-11-07 ### Added diff --git a/src/lib.rs b/src/lib.rs index 4f6cb94..b8c65c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2223,6 +2223,15 @@ impl Drop for Ftdi { } } +// Safety: Unfortunatly there is no clear statement about the thread safety of +// the D2XX library in the official programming guide. But there are mentions +// about thread-safety fixes in the release notes of the driver, which suggests +// that the library is indeed thread synchronized. It would also be quite +// strange if the D2XX driver could not be used across threads, but the VCP +// driver can. +unsafe impl Send for Ftdi {} +unsafe impl Sync for Ftdi {} + macro_rules! impl_boilerplate_for { ($DEVICE:ident, $TYPE:expr) => { impl FtdiCommon for $DEVICE {