Skip to content

Commit

Permalink
deploy: 9a0a651
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Apr 2, 2024
1 parent e078140 commit 8e97115
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
14 changes: 9 additions & 5 deletions plumbing/database_and_runtime.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,23 @@ <h2 id="incrementing-the-revision-counter-and-getting-mutable-access-to-the-jars
loop {
self.runtime.set_cancellation_flag();

// Acquire lock before we check if we have unique access to the jars.
// If we do not yet have unique access, we will go to sleep and wait for
// the snapshots to be dropped, which will signal the cond var associated
// with this lock.
//
// NB: We have to acquire the lock first to ensure that we can check for
// unique access and go to sleep waiting on the condvar atomically,
// as described in PR #474.
let mut guard = self.shared.noti_lock.lock();
// If we have unique access to the jars, we are done.
if Arc::get_mut(self.shared.jars.as_mut().unwrap()).is_some() {
return;
}

// Otherwise, wait until some other storage entities have dropped.
// We create a mutex here because the cvar api requires it, but we
// don't really need one as the data being protected is actually
// the jars above.
//
// The cvar `self.shared.cvar` is notified by the `Drop` impl.
let mutex = parking_lot::Mutex::new(());
let mut guard = mutex.lock();
self.shared.cvar.wait(&amp;mut guard);
}
}
Expand Down
1 change: 1 addition & 0 deletions plumbing/jars_and_ingredients.html
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ <h3 id="initializing-the-database"><a class="header" href="#initializing-the-dat
shared: Shared {
jars: Some(Arc::from(jars)),
cvar: Arc::new(Default::default()),
noti_lock: Arc::new(parking_lot::Mutex::new(())),
},
routes: Arc::new(routes),
runtime: Runtime::default(),
Expand Down
15 changes: 10 additions & 5 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,7 @@ <h3 id="initializing-the-database"><a class="header" href="#initializing-the-dat
shared: Shared {
jars: Some(Arc::from(jars)),
cvar: Arc::new(Default::default()),
noti_lock: Arc::new(parking_lot::Mutex::new(())),
},
routes: Arc::new(routes),
runtime: Runtime::default(),
Expand Down Expand Up @@ -1978,19 +1979,23 @@ <h2 id="incrementing-the-revision-counter-and-getting-mutable-access-to-the-jars
loop {
self.runtime.set_cancellation_flag();

// Acquire lock before we check if we have unique access to the jars.
// If we do not yet have unique access, we will go to sleep and wait for
// the snapshots to be dropped, which will signal the cond var associated
// with this lock.
//
// NB: We have to acquire the lock first to ensure that we can check for
// unique access and go to sleep waiting on the condvar atomically,
// as described in PR #474.
let mut guard = self.shared.noti_lock.lock();
// If we have unique access to the jars, we are done.
if Arc::get_mut(self.shared.jars.as_mut().unwrap()).is_some() {
return;
}

// Otherwise, wait until some other storage entities have dropped.
// We create a mutex here because the cvar api requires it, but we
// don't really need one as the data being protected is actually
// the jars above.
//
// The cvar `self.shared.cvar` is notified by the `Drop` impl.
let mutex = parking_lot::Mutex::new(());
let mut guard = mutex.lock();
self.shared.cvar.wait(&amp;mut guard);
}
}
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit 8e97115

Please sign in to comment.