Skip to content

Commit

Permalink
Don't inline URef locking.
Browse files Browse the repository at this point in the history
This should save a bit of code size and compile time at negligible
performance cost. Benchmark results are neutral.
  • Loading branch information
kpreid committed Nov 29, 2023
1 parent e7a197a commit a544010
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions all-is-cubes/src/universe/uref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ impl<T: 'static> URef<T> {
/// [`std::sync::RwLock::try_read()`].
///
/// TODO: There is not currently any way to block on / wait for read access.
#[inline(never)]
pub fn read(&self) -> Result<UBorrow<T>, RefError> {
let inner = owning_guard::UBorrowImpl::new(self.upgrade()?)
.map_err(|_| RefError::InUse(self.name()))?;
Expand All @@ -172,6 +173,7 @@ impl<T: 'static> URef<T> {
/// only use the mutation operations provided by `T`.
///
/// TODO: If possible, completely replace this operation with transactions.
#[inline(never)]
pub fn try_modify<F, Out>(&self, function: F) -> Result<Out, RefError>
where
F: FnOnce(&mut T) -> Out,
Expand Down Expand Up @@ -217,6 +219,7 @@ impl<T: 'static> URef<T> {
/// Returns an error if the transaction's preconditions were not met, if the
/// referent was already borrowed (which is denoted as an [`ExecuteError::Check`]),
/// or if the transaction encountered an unexpected error.
#[inline(never)]
pub fn execute(
&self,
transaction: &<T as Transactional>::Transaction,
Expand Down

0 comments on commit a544010

Please sign in to comment.