Skip to content

Commit 87b64e5

Browse files
committed
fixup!
1 parent e289c56 commit 87b64e5

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

crates/matrix-sdk-common/src/cross_process_lock.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ pub trait TryLock {
8787
///
8888
/// Returns `Some(_)` to indicate the lock succeeded, `None` otherwise. The
8989
/// 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
9292
/// the meantime.
9393
fn try_lock(
9494
&self,
@@ -165,7 +165,7 @@ where
165165

166166
lock_generation: Arc<AtomicCrossProcessLockGeneration>,
167167

168-
is_poisoned: Arc<AtomicBool>,
168+
is_dirty: Arc<AtomicBool>,
169169
}
170170

171171
/// Amount of time a lease of the lock should last, in milliseconds.
@@ -208,26 +208,26 @@ where
208208
lock_generation: Arc::new(AtomicCrossProcessLockGeneration::new(
209209
FIRST_CROSS_PROCESS_LOCK_GENERATION,
210210
)),
211-
is_poisoned: Arc::new(AtomicBool::new(false)),
211+
is_dirty: Arc::new(AtomicBool::new(false)),
212212
}
213213
}
214214

215-
/// Determine whether the cross-process lock is poisoned.
215+
/// Determine whether the cross-process lock is dirtied.
216216
///
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.
218218
/// You should not trust a `false` value for program correctness without
219219
/// 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)
222222
}
223223

224-
/// Clear the poisoned state from this cross-process lock.
224+
/// Clear the dirty state from this cross-process lock.
225225
///
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);
231231
self.lock_generation.store(NO_CROSS_PROCESS_LOCK_GENERATION, Ordering::SeqCst);
232232
}
233233

@@ -261,19 +261,19 @@ where
261261
{
262262
match self.lock_generation.swap(new_generation, Ordering::SeqCst) {
263263
// 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.
265265
NO_CROSS_PROCESS_LOCK_GENERATION => {
266266
trace!(?new_generation, "Setting the lock generation for the first time");
267267
}
268268

269-
// This was NOT the same generation, the lock has been poisoned!
269+
// This was NOT the same generation, the lock has been dirtied!
270270
previous_generation if previous_generation != new_generation => {
271271
warn!(
272272
?previous_generation,
273273
?new_generation,
274-
"The lock has been acquired, but it's been poisoned!"
274+
"The lock has been acquired, but it's been dirtied!"
275275
);
276-
self.is_poisoned.store(true, Ordering::SeqCst);
276+
self.is_dirty.store(true, Ordering::SeqCst);
277277
}
278278

279279
// This was the same generation, no problem.
@@ -355,14 +355,14 @@ where
355355
"It's impossible to renew a lock lease that has not been acquired once"
356356
),
357357

358-
// This was NOT the same generation, the lock has been poisoned!
358+
// This was NOT the same generation, the lock has been dirtied!
359359
previous_generation if previous_generation != new_generation => {
360360
warn!(
361361
?previous_generation,
362362
?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!"
364364
);
365-
this.is_poisoned.store(true, Ordering::SeqCst);
365+
this.is_dirty.store(true, Ordering::SeqCst);
366366

367367
// Exit the loop.
368368
break;

0 commit comments

Comments
 (0)