Skip to content

Commit

Permalink
drain remove
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Aug 9, 2024
1 parent 88ffad0 commit 8530a27
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ impl<Id: TransactionId> Lock<Id> {
return;
}

for id in self.current_locks.drain(..) {
conflict_callback(&id);
}
// Only single lock, so call on the conflict and
// clear the current lock.
conflict_callback(&current_write_id);
self.current_locks.clear();
self.kind = AccessKind::Read;
self.current_locks.push(id);
self.most_recent_write = Some(current_write_id);
Expand All @@ -73,9 +74,11 @@ impl<Id: TransactionId> Lock<Id> {
return;
}

for id in self.current_locks.drain(..) {
conflict_callback(&id);
}
// Only single lock, so call on the conflict and
// clear the current lock.
conflict_callback(&current_write_id);
self.current_locks.clear();

self.current_locks.push(id);
}
}
Expand Down

0 comments on commit 8530a27

Please sign in to comment.