mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-23 05:07:27 +00:00
remove the start_query
function, which is no longer needed
This commit is contained in:
parent
b0171dbc11
commit
252132f9b4
2 changed files with 5 additions and 28 deletions
|
@ -245,8 +245,11 @@ where
|
|||
) -> Result<StampedValue<Q::Value>, CycleDetected> {
|
||||
let runtime = db.salsa_runtime();
|
||||
|
||||
let _read_lock = runtime.start_query();
|
||||
|
||||
// NB: We don't need to worry about people modifying the
|
||||
// revision out from under our feet. Either `db` is a frozen
|
||||
// database, in which case there is a lock, or the mutator
|
||||
// thread is the current thread, and it will be prevented from
|
||||
// doing any `set` invocations while the query function runs.
|
||||
let revision_now = runtime.current_revision();
|
||||
|
||||
info!(
|
||||
|
@ -692,12 +695,6 @@ where
|
|||
let runtime = db.salsa_runtime();
|
||||
let revision_now = runtime.current_revision();
|
||||
|
||||
// If a query is in progress, we know that the current
|
||||
// revision is not changing.
|
||||
if !runtime.query_in_progress() {
|
||||
panic!("maybe_changed_since invoked outside of query execution")
|
||||
}
|
||||
|
||||
debug!(
|
||||
"{:?}({:?})::maybe_changed_since(revision={:?}, revision_now={:?})",
|
||||
Q::default(),
|
||||
|
|
|
@ -130,26 +130,6 @@ where
|
|||
db.for_each_query(|query_storage| query_storage.sweep(db, strategy));
|
||||
}
|
||||
|
||||
/// Indicates that a derived query has begun to execute; if this is the
|
||||
/// first derived query on this thread, then acquires a read-lock on the
|
||||
/// runtime to prevent us from moving to a new revision until that query
|
||||
/// completes.
|
||||
///
|
||||
/// (However, if other threads invoke `increment_revision`, then
|
||||
/// the current revision may be considered cancelled, which can be
|
||||
/// observed through `is_current_revision_canceled`.)
|
||||
pub(crate) fn start_query(&self) -> Option<QueryGuard<'_, DB>> {
|
||||
let mut local_state = self.local_state.borrow_mut();
|
||||
if !local_state.query_in_progress {
|
||||
local_state.query_in_progress = true;
|
||||
let guard = self.shared_state.query_lock.read();
|
||||
|
||||
Some(QueryGuard::new(self, guard))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// The unique identifier attached to this `SalsaRuntime`. Each
|
||||
/// forked runtime has a distinct identifier.
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue