Skip to content

Commit

Permalink
Add a Sync bound for GenericMutexGuard. Fixes Matthias247#53.
Browse files Browse the repository at this point in the history
  • Loading branch information
ammaraskar committed Nov 1, 2020
1 parent 9ee6993 commit 83d601d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sync/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ impl<MutexType: RawMutex, T> DerefMut for GenericMutexGuard<'_, MutexType, T> {
}
}

// Safety: GenericMutexGuard may only be used across threads if the underlying
// type is Sync.
unsafe impl<MutexType: RawMutex, T: Sync> Sync
for GenericMutexGuard<'_, MutexType, T>
{
}

/// A future which resolves when the target mutex has been successfully acquired.
#[must_use = "futures do nothing unless polled"]
pub struct GenericMutexLockFuture<'a, MutexType: RawMutex, T: 'a> {
Expand Down

0 comments on commit 83d601d

Please sign in to comment.