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 523b3d5 commit e9bc1d1Copy full SHA for e9bc1d1
library/std/src/sync/reentrant_lock.rs
@@ -344,6 +344,17 @@ impl<T: ?Sized> ReentrantLock<T> {
344
}
345
346
347
+ /// Returns a raw pointer to the underlying data.
348
+ ///
349
+ /// The returned pointer is always non-null and properly aligned, but it is
350
+ /// the user's responsibility to ensure that any reads through it are
351
+ /// properly synchronized to avoid data races, and that it is not read
352
+ /// through after the lock is dropped.
353
+ #[unstable(feature = "reentrant_lock_data_ptr", issue = "140368")]
354
+ pub fn data_ptr(&self) -> *const T {
355
+ &raw const self.data
356
+ }
357
+
358
unsafe fn increment_lock_count(&self) -> Option<()> {
359
unsafe {
360
*self.lock_count.get() = (*self.lock_count.get()).checked_add(1)?;
0 commit comments