Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed Oct 22, 2023
1 parent ed6396c commit 09522c9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,16 @@ impl<T: ?Sized> Weak<T> {
/// ```
#[inline]
pub fn upgrade(&self) -> Option<Trc<T>> {
#[cfg(immortals)]
if value.load(core::sync::atomic::Ordering::Acquire) == usize::MAX {
//SAFETY: The data is guaranteed to not be dropped.
let tbx = Box::new(1);
Trc {
threadref: NonNull::from(Box::leak(tbx)),
shared: self.data,
}
}

unsafe { self.data.as_ref() }
.atomicref
.fetch_update(
Expand Down

0 comments on commit 09522c9

Please sign in to comment.