@@ -87,8 +87,8 @@ pub trait TryLock {
87
87
///
88
88
/// Returns `Some(_)` to indicate the lock succeeded, `None` otherwise. The
89
89
/// cross-process lock generation must be compared to the generation before
90
- /// the call to see if the lock has been poisoned : a different generation
91
- /// means the lock has been poisoned , i.e. taken by a different holder in
90
+ /// the call to see if the lock has been dirtied : a different generation
91
+ /// means the lock has been dirtied , i.e. taken by a different holder in
92
92
/// the meantime.
93
93
fn try_lock (
94
94
& self ,
@@ -165,7 +165,7 @@ where
165
165
166
166
lock_generation : Arc < AtomicCrossProcessLockGeneration > ,
167
167
168
- is_poisoned : Arc < AtomicBool > ,
168
+ is_dirty : Arc < AtomicBool > ,
169
169
}
170
170
171
171
/// Amount of time a lease of the lock should last, in milliseconds.
@@ -208,26 +208,26 @@ where
208
208
lock_generation : Arc :: new ( AtomicCrossProcessLockGeneration :: new (
209
209
FIRST_CROSS_PROCESS_LOCK_GENERATION ,
210
210
) ) ,
211
- is_poisoned : Arc :: new ( AtomicBool :: new ( false ) ) ,
211
+ is_dirty : Arc :: new ( AtomicBool :: new ( false ) ) ,
212
212
}
213
213
}
214
214
215
- /// Determine whether the cross-process lock is poisoned .
215
+ /// Determine whether the cross-process lock is dirtied .
216
216
///
217
- /// If another process has taken the lock, then this lock becomes poisoned .
217
+ /// If another process has taken the lock, then this lock becomes dirty .
218
218
/// You should not trust a `false` value for program correctness without
219
219
/// additional synchronisation.
220
- pub fn is_poisoned ( & self ) -> bool {
221
- self . is_poisoned . load ( Ordering :: SeqCst )
220
+ pub fn is_dirty ( & self ) -> bool {
221
+ self . is_dirty . load ( Ordering :: SeqCst )
222
222
}
223
223
224
- /// Clear the poisoned state from this cross-process lock.
224
+ /// Clear the dirty state from this cross-process lock.
225
225
///
226
- /// If the cross-process lock is poisoned , it will remain poisoned until
227
- /// this method is called. This allows recovering from a poisoned
228
- /// state and marking that it has recovered.
229
- pub fn clear_poison ( & self ) {
230
- self . is_poisoned . store ( false , Ordering :: SeqCst ) ;
226
+ /// If the cross-process lock is dirtied , it will remain dirtied until
227
+ /// this method is called. This allows recovering from a dirty state and
228
+ /// marking that it has recovered.
229
+ pub fn clear_dirty ( & self ) {
230
+ self . is_dirty . store ( false , Ordering :: SeqCst ) ;
231
231
self . lock_generation . store ( NO_CROSS_PROCESS_LOCK_GENERATION , Ordering :: SeqCst ) ;
232
232
}
233
233
@@ -261,19 +261,19 @@ where
261
261
{
262
262
match self . lock_generation . swap ( new_generation, Ordering :: SeqCst ) {
263
263
// If there was no lock generation, it means this is the first time the lock is
264
- // acquired. It cannot be poisoned .
264
+ // acquired. It cannot be dirty .
265
265
NO_CROSS_PROCESS_LOCK_GENERATION => {
266
266
trace ! ( ?new_generation, "Setting the lock generation for the first time" ) ;
267
267
}
268
268
269
- // This was NOT the same generation, the lock has been poisoned !
269
+ // This was NOT the same generation, the lock has been dirtied !
270
270
previous_generation if previous_generation != new_generation => {
271
271
warn ! (
272
272
?previous_generation,
273
273
?new_generation,
274
- "The lock has been acquired, but it's been poisoned !"
274
+ "The lock has been acquired, but it's been dirtied !"
275
275
) ;
276
- self . is_poisoned . store ( true , Ordering :: SeqCst ) ;
276
+ self . is_dirty . store ( true , Ordering :: SeqCst ) ;
277
277
}
278
278
279
279
// This was the same generation, no problem.
@@ -355,14 +355,14 @@ where
355
355
"It's impossible to renew a lock lease that has not been acquired once"
356
356
) ,
357
357
358
- // This was NOT the same generation, the lock has been poisoned !
358
+ // This was NOT the same generation, the lock has been dirtied !
359
359
previous_generation if previous_generation != new_generation => {
360
360
warn ! (
361
361
?previous_generation,
362
362
?new_generation,
363
- "The lock lease has been renewed, but it's been poisoned !"
363
+ "The lock lease has been renewed, but it's been dirtied !"
364
364
) ;
365
- this. is_poisoned . store ( true , Ordering :: SeqCst ) ;
365
+ this. is_dirty . store ( true , Ordering :: SeqCst ) ;
366
366
367
367
// Exit the loop.
368
368
break ;
0 commit comments