File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
library/std/src/sync/poison Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -608,6 +608,12 @@ impl<T: ?Sized> Mutex<T> {
608608 let data = self . data . get_mut ( ) ;
609609 poison:: map_result ( self . poison . borrow ( ) , |( ) | data)
610610 }
611+
612+ /// Returns a raw pointer to the underlying data.
613+ #[ unstable( feature = "mutex_data_ptr" , issue = "140368" ) ]
614+ pub fn data_ptr ( & self ) -> * mut T {
615+ self . data . get ( )
616+ }
611617}
612618
613619#[ stable( feature = "mutex_from" , since = "1.24.0" ) ]
Original file line number Diff line number Diff line change @@ -634,6 +634,12 @@ impl<T: ?Sized> RwLock<T> {
634634 let data = self . data . get_mut ( ) ;
635635 poison:: map_result ( self . poison . borrow ( ) , |( ) | data)
636636 }
637+
638+ /// Returns a raw pointer to the underlying data.
639+ #[ unstable( feature = "rwlock_data_ptr" , issue = "140368" ) ]
640+ pub fn data_ptr ( & self ) -> * mut T {
641+ self . data . get ( )
642+ }
637643}
638644
639645#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments