You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use-case where I need to manually manage locking/unlocking a Mutex, and can't store the MutexGuard between locking and accessing the locked data. It's possible to perform locking and unlocking of the RawMutex manually from outside this crate using the Mutex::raw() method, as well as mem::forget(mutex.lock()) and mutex.force_unlock(), but there appears to be no API to then unsafely access the raw data guarded by a &Mutex.
It would be nice to expose a method to extract the raw pointer to the mutex-guarded data within the UnsafeCell, perhaps with something like the following:
/// Returns a raw pointer to the underlying data.////// # Safety////// The returned pointer may only be dereferenced if the current thread logically/// owns a `MutexGuard`, but that guard has been discarded using `mem::forget`.pubfndata_ptr(&self) -> *mutT{self.data.get()}
The text was updated successfully, but these errors were encountered:
I have a use-case where I need to manually manage locking/unlocking a
Mutex
, and can't store theMutexGuard
between locking and accessing the locked data. It's possible to perform locking and unlocking of theRawMutex
manually from outside this crate using theMutex::raw()
method, as well asmem::forget(mutex.lock())
andmutex.force_unlock()
, but there appears to be no API to then unsafely access the raw data guarded by a&Mutex
.It would be nice to expose a method to extract the raw pointer to the mutex-guarded data within the
UnsafeCell
, perhaps with something like the following:The text was updated successfully, but these errors were encountered: