atomic_refcell icon indicating copy to clipboard operation
atomic_refcell copied to clipboard

AtomicWeakRef

Open BTOdell opened this issue 1 year ago • 0 comments

Would it be possible to add a weak reference type to this library that doesn't include a lifetime parameter? I've been trying to create something similar to "Box" but with thread-safe weak pointers; or "Arc" but with the ability to into_inner and get the original value out.

Your library almost satisfies my requirements, but the lifetime requirement on the AtomicRef was problematic.

For reference: https://www.reddit.com/r/rust/comments/1aq8zzf/help_implementing_an_atomic_reference_box_type/

Note that in my partial-implementation, the into_inner function can block until the weak references aren't actively borrowing. Not sure how this behavior would be accomplished in your library.

BTOdell avatar Feb 14 '24 01:02 BTOdell