From 54cbd34d2ebbe942806d963021de63afbaaf37ac Mon Sep 17 00:00:00 2001 From: Artem Krylysov Date: Fri, 9 Jul 2021 01:27:04 -0400 Subject: [PATCH] Mark Cache and Env as Send and Sync (#530) --- src/db_options.rs | 4 ++++ src/lib.rs | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/db_options.rs b/src/db_options.rs index 7e42f8f..db0f7d7 100644 --- a/src/db_options.rs +++ b/src/db_options.rs @@ -384,6 +384,8 @@ unsafe impl Send for BlockBasedOptions {} unsafe impl Send for CuckooTableOptions {} unsafe impl Send for ReadOptions {} unsafe impl Send for IngestExternalFileOptions {} +unsafe impl Send for Cache {} +unsafe impl Send for Env {} // Sync is similarly safe for many types because they do not expose interior mutability, and their // use within the rocksdb library is generally behind a const reference @@ -393,6 +395,8 @@ unsafe impl Sync for BlockBasedOptions {} unsafe impl Sync for CuckooTableOptions {} unsafe impl Sync for ReadOptions {} unsafe impl Sync for IngestExternalFileOptions {} +unsafe impl Sync for Cache {} +unsafe impl Sync for Env {} impl Drop for Options { fn drop(&mut self) { diff --git a/src/lib.rs b/src/lib.rs index 58110f2..869135f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,9 +172,10 @@ impl fmt::Display for Error { #[cfg(test)] mod test { use super::{ - BlockBasedOptions, BoundColumnFamily, ColumnFamily, ColumnFamilyDescriptor, DBIterator, - DBRawIterator, IngestExternalFileOptions, Options, PlainTableFactoryOptions, ReadOptions, - Snapshot, SstFileWriter, WriteBatch, WriteOptions, DB, + BlockBasedOptions, BoundColumnFamily, Cache, ColumnFamily, ColumnFamilyDescriptor, + DBIterator, DBRawIterator, Env, IngestExternalFileOptions, Options, + PlainTableFactoryOptions, ReadOptions, Snapshot, SstFileWriter, WriteBatch, WriteOptions, + DB, }; #[test] @@ -201,6 +202,8 @@ mod test { is_send::>(); is_send::(); is_send::(); + is_send::(); + is_send::(); } #[test] @@ -221,5 +224,7 @@ mod test { is_sync::(); is_sync::(); is_sync::(); + is_sync::(); + is_sync::(); } }