We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d6c5a8 commit 20589bdCopy full SHA for 20589bd
library/std/src/sync/reentrant_lock.rs
@@ -349,6 +349,17 @@ impl<T: ?Sized> ReentrantLock<T> {
349
}
350
351
352
+ /// Returns a raw pointer to the underlying data.
353
+ ///
354
+ /// The returned pointer is always non-null and properly aligned, but it is
355
+ /// the user's responsibility to ensure that any reads through it are
356
+ /// properly synchronized to avoid data races, and that it is not read
357
+ /// through after the lock is dropped.
358
+ #[unstable(feature = "reentrant_lock_data_ptr", issue = "140368")]
359
+ pub fn data_ptr(&self) -> *const T {
360
+ &raw const self.data
361
+ }
362
+
363
unsafe fn increment_lock_count(&self) -> Option<()> {
364
unsafe {
365
*self.lock_count.get() = (*self.lock_count.get()).checked_add(1)?;
0 commit comments