summaryrefslogtreecommitdiffstats
path: root/tokio-sync
diff options
context:
space:
mode:
authorKevin Leimkuhler <kevin@kleimkuhler.com>2019-06-03 11:12:28 -0700
committerCarl Lerche <me@carllerche.com>2019-06-03 11:12:28 -0700
commit619efed28b64858016c9a3a5b0f425f3e32e076e (patch)
tree9601e9de444b3955668a7a1c1d8e11ea7ac41703 /tokio-sync
parent18ed0be851a398aa4d489d80c2f611ed0d0549f1 (diff)
sync: Add Sync impl for Lock (#1116)
Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
Diffstat (limited to 'tokio-sync')
-rw-r--r--tokio-sync/src/lock.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tokio-sync/src/lock.rs b/tokio-sync/src/lock.rs
index 017af197..3cfa1beb 100644
--- a/tokio-sync/src/lock.rs
+++ b/tokio-sync/src/lock.rs
@@ -69,9 +69,11 @@ pub struct Lock<T> {
#[derive(Debug)]
pub struct LockGuard<T>(Lock<T>);
-// As long as T: Send, it's fine to send Lock<T> to other threads.
-// If T was not Send, sending a Lock<T> would be bad, since you can access T through Lock<T>.
+// As long as T: Send, it's fine to send and share Lock<T> between threads.
+// If T was not Send, sending and sharing a Lock<T> would be bad, since you can access T through
+// Lock<T>.
unsafe impl<T> Send for Lock<T> where T: Send {}
+unsafe impl<T> Sync for Lock<T> where T: Send {}
unsafe impl<T> Sync for LockGuard<T> where T: Send + Sync {}
#[derive(Debug)]