@@ -8,7 +8,7 @@ use horde::sync_table::Write;
88use rustc_hash:: FxBuildHasher ;
99
1010use crate :: sharded:: IntoPointer ;
11- use crate :: sync:: { DynSync , Lock , LockGuard } ;
11+ use crate :: sync:: { DynSync , Lock , LockGuard , Mode } ;
1212
1313pub struct SyncTable < K , V > {
1414 // We use this lock to protect `table` instead of the internal mutex in `horde::SyncTable`
@@ -120,9 +120,11 @@ impl<K: Eq + Hash + Copy + Send> SyncTable<K, ()> {
120120
121121 let mut write = self . lock ( ) ;
122122
123- let entry = self . read ( pin) . get ( value, Some ( hash) ) ;
124- if let Some ( entry) = entry {
125- return * entry. 0 ;
123+ if self . lock . mode ( ) == Mode :: Sync {
124+ let entry = self . read ( pin) . get ( value, Some ( hash) ) ;
125+ if let Some ( entry) = entry {
126+ return * entry. 0 ;
127+ }
126128 }
127129
128130 let result = make ( ) ;
@@ -149,9 +151,11 @@ impl<K: Eq + Hash + Copy + Send> SyncTable<K, ()> {
149151
150152 let mut write = self . lock ( ) ;
151153
152- let entry = self . read ( pin) . get ( & value, Some ( hash) ) ;
153- if let Some ( entry) = entry {
154- return * entry. 0 ;
154+ if self . lock . mode ( ) == Mode :: Sync {
155+ let entry = self . read ( pin) . get ( & value, Some ( hash) ) ;
156+ if let Some ( entry) = entry {
157+ return * entry. 0 ;
158+ }
155159 }
156160
157161 let result = make ( value) ;
0 commit comments