Skip to content

Commit 6962d2f

Browse files
authored
Merge pull request #370 from a1phyr/rwlock_guard_sync
2 parents 3afcf68 + c5c8126 commit 6962d2f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lock_api/src/rwlock.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,8 @@ pub struct RwLockReadGuard<'a, R: RawRwLock, T: ?Sized> {
11891189
marker: PhantomData<(&'a T, R::GuardMarker)>,
11901190
}
11911191

1192+
unsafe impl<R: RawRwLock + Sync, T: Sync + ?Sized> Sync for RwLockReadGuard<'_, R, T> {}
1193+
11921194
impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> RwLockReadGuard<'a, R, T> {
11931195
/// Returns a reference to the original reader-writer lock object.
11941196
pub fn rwlock(s: &Self) -> &'a RwLock<R, T> {
@@ -1477,6 +1479,8 @@ pub struct RwLockWriteGuard<'a, R: RawRwLock, T: ?Sized> {
14771479
marker: PhantomData<(&'a mut T, R::GuardMarker)>,
14781480
}
14791481

1482+
unsafe impl<R: RawRwLock + Sync, T: Sync + ?Sized> Sync for RwLockWriteGuard<'_, R, T> {}
1483+
14801484
impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> RwLockWriteGuard<'a, R, T> {
14811485
/// Returns a reference to the original reader-writer lock object.
14821486
pub fn rwlock(s: &Self) -> &'a RwLock<R, T> {

0 commit comments

Comments
 (0)