mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-27 15:07:03 +00:00
Merge pull request #19 from matklad/assert
Assert inputs are not modified concurrently
This commit is contained in:
commit
e7d55de454
1 changed files with 4 additions and 4 deletions
|
@ -62,10 +62,6 @@ where
|
||||||
/// case, you can wrap the input with a "no-storage" query and
|
/// case, you can wrap the input with a "no-storage" query and
|
||||||
/// invoke this method from time to time.
|
/// invoke this method from time to time.
|
||||||
pub fn next_revision(&self) {
|
pub fn next_revision(&self) {
|
||||||
if !self.local_state.borrow().query_stack.is_empty() {
|
|
||||||
panic!("next_revision invoked during a query computation");
|
|
||||||
}
|
|
||||||
|
|
||||||
self.increment_revision();
|
self.increment_revision();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +74,10 @@ where
|
||||||
|
|
||||||
/// Increments the current revision counter and returns the new value.
|
/// Increments the current revision counter and returns the new value.
|
||||||
crate fn increment_revision(&self) -> Revision {
|
crate fn increment_revision(&self) -> Revision {
|
||||||
|
if !self.local_state.borrow().query_stack.is_empty() {
|
||||||
|
panic!("increment_revision invoked during a query computation");
|
||||||
|
}
|
||||||
|
|
||||||
let result = Revision {
|
let result = Revision {
|
||||||
generation: 1 + self.shared_state.revision.fetch_add(1, Ordering::SeqCst),
|
generation: 1 + self.shared_state.revision.fetch_add(1, Ordering::SeqCst),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue