@@ -86,62 +86,3 @@ impl RWLock {
8686 self . 0 . destroy ( )
8787 }
8888}
89-
90- // the cfg annotations only exist due to dead code warnings. the code itself is portable
91- #[ cfg( unix) ]
92- pub struct StaticRWLock ( RWLock ) ;
93-
94- #[ cfg( unix) ]
95- impl StaticRWLock {
96- pub const fn new ( ) -> StaticRWLock {
97- StaticRWLock ( RWLock :: new ( ) )
98- }
99-
100- /// Acquires shared access to the underlying lock, blocking the current
101- /// thread to do so.
102- ///
103- /// The lock is automatically unlocked when the returned guard is dropped.
104- #[ inline]
105- pub fn read_with_guard ( & ' static self ) -> RWLockReadGuard {
106- // SAFETY: All methods require static references, therefore self
107- // cannot be moved between invocations.
108- unsafe {
109- self . 0 . read ( ) ;
110- }
111- RWLockReadGuard ( & self . 0 )
112- }
113-
114- /// Acquires write access to the underlying lock, blocking the current thread
115- /// to do so.
116- ///
117- /// The lock is automatically unlocked when the returned guard is dropped.
118- #[ inline]
119- pub fn write_with_guard ( & ' static self ) -> RWLockWriteGuard {
120- // SAFETY: All methods require static references, therefore self
121- // cannot be moved between invocations.
122- unsafe {
123- self . 0 . write ( ) ;
124- }
125- RWLockWriteGuard ( & self . 0 )
126- }
127- }
128-
129- #[ cfg( unix) ]
130- pub struct RWLockReadGuard ( & ' static RWLock ) ;
131-
132- #[ cfg( unix) ]
133- impl Drop for RWLockReadGuard {
134- fn drop ( & mut self ) {
135- unsafe { self . 0 . read_unlock ( ) }
136- }
137- }
138-
139- #[ cfg( unix) ]
140- pub struct RWLockWriteGuard ( & ' static RWLock ) ;
141-
142- #[ cfg( unix) ]
143- impl Drop for RWLockWriteGuard {
144- fn drop ( & mut self ) {
145- unsafe { self . 0 . write_unlock ( ) }
146- }
147- }
0 commit comments