From 1f760d5d1a448c08ff4b66cfa8d35d39a5d667c0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 5 Aug 2014 16:40:04 -0700 Subject: Rename `Share` to `Sync` This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change] --- src/libsync/atomic.rs | 2 +- src/libsync/comm/mod.rs | 12 ++++++------ src/libsync/deque.rs | 10 +++++----- src/libsync/lock.rs | 10 +++++----- src/libsync/raw.rs | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/libsync') diff --git a/src/libsync/atomic.rs b/src/libsync/atomic.rs index 101d869451c..31b993d8bab 100644 --- a/src/libsync/atomic.rs +++ b/src/libsync/atomic.rs @@ -25,7 +25,7 @@ //! //! [1]: http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync //! -//! Atomic variables are safe to share between threads (they implement `Share`) +//! Atomic variables are safe to share between threads (they implement `Sync`) //! but they do not themselves provide the mechanism for sharing. The most //! common way to share an atomic variable is to put it into an `Arc` (an //! atomically-reference-counted shared pointer). diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index eff4cea1c43..45016b97566 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -375,7 +375,7 @@ pub struct Receiver { inner: UnsafeCell>, receives: Cell, // can't share in an arc - marker: marker::NoShare, + marker: marker::NoSync, } /// An iterator over messages on a receiver, this iterator will block @@ -393,7 +393,7 @@ pub struct Sender { inner: UnsafeCell>, sends: Cell, // can't share in an arc - marker: marker::NoShare, + marker: marker::NoSync, } /// The sending-half of Rust's synchronous channel type. This half can only be @@ -402,7 +402,7 @@ pub struct Sender { pub struct SyncSender { inner: Arc>>, // can't share in an arc - marker: marker::NoShare, + marker: marker::NoSync, } /// This enumeration is the list of the possible reasons that try_recv could not @@ -537,7 +537,7 @@ impl Sender { Sender { inner: UnsafeCell::new(inner), sends: Cell::new(0), - marker: marker::NoShare, + marker: marker::NoSync, } } @@ -713,7 +713,7 @@ impl Drop for Sender { impl SyncSender { fn new(inner: Arc>>) -> SyncSender { - SyncSender { inner: inner, marker: marker::NoShare } + SyncSender { inner: inner, marker: marker::NoSync } } /// Sends a value on this synchronous channel. @@ -801,7 +801,7 @@ impl Drop for SyncSender { impl Receiver { fn new(inner: Flavor) -> Receiver { - Receiver { inner: UnsafeCell::new(inner), receives: Cell::new(0), marker: marker::NoShare } + Receiver { inner: UnsafeCell::new(inner), receives: Cell::new(0), marker: marker::NoSync } } /// Blocks waiting for a value on this receiver diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index d5a05e7a681..e70a730dc3a 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -87,7 +87,7 @@ struct Deque { /// There may only be one worker per deque. pub struct Worker { deque: Arc>, - noshare: marker::NoShare, + noshare: marker::NoSync, } /// The stealing half of the work-stealing deque. Stealers have access to the @@ -95,7 +95,7 @@ pub struct Worker { /// `steal` method. pub struct Stealer { deque: Arc>, - noshare: marker::NoShare, + noshare: marker::NoSync, } /// When stealing some data, this is an enumeration of the possible outcomes. @@ -153,8 +153,8 @@ impl BufferPool { pub fn deque(&self) -> (Worker, Stealer) { let a = Arc::new(Deque::new(self.clone())); let b = a.clone(); - (Worker { deque: a, noshare: marker::NoShare }, - Stealer { deque: b, noshare: marker::NoShare }) + (Worker { deque: a, noshare: marker::NoSync }, + Stealer { deque: b, noshare: marker::NoSync }) } fn alloc(&mut self, bits: uint) -> Box> { @@ -217,7 +217,7 @@ impl Stealer { impl Clone for Stealer { fn clone(&self) -> Stealer { - Stealer { deque: self.deque.clone(), noshare: marker::NoShare } + Stealer { deque: self.deque.clone(), noshare: marker::NoSync } } } diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs index 665cd48a278..b07d06ca18e 100644 --- a/src/libsync/lock.rs +++ b/src/libsync/lock.rs @@ -298,7 +298,7 @@ pub struct RWLockReadGuard<'a, T> { _guard: raw::RWLockReadGuard<'a>, } -impl RWLock { +impl RWLock { /// Create a reader/writer lock with the supplied data. pub fn new(user_data: T) -> RWLock { RWLock::new_with_condvars(user_data, 1) @@ -359,7 +359,7 @@ impl RWLock { } } -impl<'a, T: Send + Share> RWLockWriteGuard<'a, T> { +impl<'a, T: Send + Sync> RWLockWriteGuard<'a, T> { /// Consumes this write lock token, returning a new read lock token. /// /// This will allow pending readers to come into the lock. @@ -375,13 +375,13 @@ impl<'a, T: Send + Share> RWLockWriteGuard<'a, T> { } } -impl<'a, T: Send + Share> Deref for RWLockReadGuard<'a, T> { +impl<'a, T: Send + Sync> Deref for RWLockReadGuard<'a, T> { fn deref<'a>(&'a self) -> &'a T { self._data } } -impl<'a, T: Send + Share> Deref for RWLockWriteGuard<'a, T> { +impl<'a, T: Send + Sync> Deref for RWLockWriteGuard<'a, T> { fn deref<'a>(&'a self) -> &'a T { &*self._data } } -impl<'a, T: Send + Share> DerefMut for RWLockWriteGuard<'a, T> { +impl<'a, T: Send + Sync> DerefMut for RWLockWriteGuard<'a, T> { fn deref_mut<'a>(&'a mut self) -> &'a mut T { &mut *self._data } } diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index 49f60fe6f00..c42d567fc18 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -87,7 +87,7 @@ impl WaitQueue { // The building-block used to make semaphores, mutexes, and rwlocks. struct Sem { lock: mutex::Mutex, - // n.b, we need Sem to be `Share`, but the WaitQueue type is not send/share + // n.b, we need Sem to be `Sync`, but the WaitQueue type is not send/share // (for good reason). We have an internal invariant on this semaphore, // however, that the queue is never accessed outside of a locked // context. -- cgit 1.4.1-3-g733a5