Skip to content

Commit

Permalink
Merge pull request #370 from a1phyr/rwlock_guard_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu authored Jun 5, 2023
2 parents 3afcf68 + c5c8126 commit 6962d2f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lock_api/src/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,8 @@ pub struct RwLockReadGuard<'a, R: RawRwLock, T: ?Sized> {
marker: PhantomData<(&'a T, R::GuardMarker)>,
}

unsafe impl<R: RawRwLock + Sync, T: Sync + ?Sized> Sync for RwLockReadGuard<'_, R, T> {}

impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> RwLockReadGuard<'a, R, T> {
/// Returns a reference to the original reader-writer lock object.
pub fn rwlock(s: &Self) -> &'a RwLock<R, T> {
Expand Down Expand Up @@ -1477,6 +1479,8 @@ pub struct RwLockWriteGuard<'a, R: RawRwLock, T: ?Sized> {
marker: PhantomData<(&'a mut T, R::GuardMarker)>,
}

unsafe impl<R: RawRwLock + Sync, T: Sync + ?Sized> Sync for RwLockWriteGuard<'_, R, T> {}

impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> RwLockWriteGuard<'a, R, T> {
/// Returns a reference to the original reader-writer lock object.
pub fn rwlock(s: &Self) -> &'a RwLock<R, T> {
Expand Down

0 comments on commit 6962d2f

Please sign in to comment.