Skip to content

Commit b2cc5a1

Browse files
committed
Expose API to manually trigger cancellation
1 parent c3f86b8 commit b2cc5a1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/database.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ pub trait Database: Send + ZalsaDatabase + AsDynDatabase {
5959
zalsa_mut.runtime_mut().report_tracked_write(durability);
6060
}
6161

62+
/// This method triggers cancellation.
63+
/// If you invoke it while a snapshot exists, it
64+
/// will block until that snapshot is dropped -- if that snapshot
65+
/// is owned by the current thread, this could trigger deadlock.
66+
fn trigger_cancellation(&mut self) {
67+
let _ = self.zalsa_mut();
68+
}
69+
6270
/// Reports that the query depends on some state unknown to salsa.
6371
///
6472
/// Queries which report untracked reads will be re-executed in the next

0 commit comments

Comments
 (0)