44
44
///
45
45
fn insert ( & self , key : K , value : V ) -> Result < ( ) > {
46
46
// Determine if an atomic batch is in progress.
47
- let is_batch = self . batch_in_progress . load ( Ordering :: SeqCst ) ;
47
+ let is_batch = self . batch_in_progress . load ( Ordering :: Acquire ) ;
48
48
49
49
match is_batch {
50
50
// If a batch is in progress, add the key-value pair to the batch.
68
68
///
69
69
fn remove ( & self , key : & K ) -> Result < ( ) > {
70
70
// Determine if an atomic batch is in progress.
71
- let is_batch = self . batch_in_progress . load ( Ordering :: SeqCst ) ;
71
+ let is_batch = self . batch_in_progress . load ( Ordering :: Acquire ) ;
72
72
73
73
match is_batch {
74
74
// If a batch is in progress, add the key to the batch.
92
92
///
93
93
fn start_atomic ( & self ) {
94
94
// Set the atomic batch flag to `true`.
95
- self . batch_in_progress . store ( true , Ordering :: SeqCst ) ;
95
+ self . batch_in_progress . store ( true , Ordering :: Relaxed ) ;
96
96
// Ensure that the atomic batch is empty.
97
97
assert ! ( self . atomic_batch. lock( ) . is_empty( ) ) ;
98
98
}
@@ -103,7 +103,7 @@ impl<
103
103
/// if they are already part of a larger one.
104
104
///
105
105
fn is_atomic_in_progress ( & self ) -> bool {
106
- self . batch_in_progress . load ( Ordering :: SeqCst )
106
+ self . batch_in_progress . load ( Ordering :: Acquire )
107
107
}
108
108
109
109
///
@@ -113,7 +113,7 @@ impl<
113
113
// Clear the atomic batch.
114
114
* self . atomic_batch . lock ( ) = Default :: default ( ) ;
115
115
// Set the atomic batch flag to `false`.
116
- self . batch_in_progress . store ( false , Ordering :: SeqCst ) ;
116
+ self . batch_in_progress . store ( false , Ordering :: Release ) ;
117
117
}
118
118
119
119
///
@@ -146,7 +146,7 @@ impl<
146
146
}
147
147
148
148
// Set the atomic batch flag to `false`.
149
- self . batch_in_progress . store ( false , Ordering :: SeqCst ) ;
149
+ self . batch_in_progress . store ( false , Ordering :: Release ) ;
150
150
151
151
Ok ( ( ) )
152
152
}
@@ -201,7 +201,7 @@ impl<
201
201
K : Borrow < Q > ,
202
202
Q : PartialEq + Eq + Hash + Serialize + ?Sized ,
203
203
{
204
- if self . batch_in_progress . load ( Ordering :: SeqCst ) { self . atomic_batch . lock ( ) . get ( key) . cloned ( ) } else { None }
204
+ if self . batch_in_progress . load ( Ordering :: Acquire ) { self . atomic_batch . lock ( ) . get ( key) . cloned ( ) } else { None }
205
205
}
206
206
207
207
///
0 commit comments