std: Second pass stabilization of sync
This pass performs a second pass of stabilization through the `std::sync` module, avoiding modules/types that are being handled in other PRs (e.g. mutexes, rwlocks, condvars, and channels). The following items are now stable * `sync::atomic` * `sync::atomic::ATOMIC_BOOL_INIT` (was `INIT_ATOMIC_BOOL`) * `sync::atomic::ATOMIC_INT_INIT` (was `INIT_ATOMIC_INT`) * `sync::atomic::ATOMIC_UINT_INIT` (was `INIT_ATOMIC_UINT`) * `sync::Once` * `sync::ONCE_INIT` * `sync::Once::call_once` (was `doit`) * C == `pthread_once(..)` * Boost == `call_once(..)` * Windows == `InitOnceExecuteOnce` * `sync::Barrier` * `sync::Barrier::new` * `sync::Barrier::wait` (now returns a `bool`) * `sync::Semaphore::new` * `sync::Semaphore::acquire` * `sync::Semaphore::release` The following items remain unstable * `sync::SemaphoreGuard` * `sync::Semaphore::access` - it's unclear how this relates to the poisoning story of mutexes. * `sync::TaskPool` - the semantics of a failing task and whether a thread is re-attached to a thread pool are somewhat unclear, and the utility of this type in `sync` is question with respect to the jobs of other primitives. This type will likely become stable or move out of the standard library over time. * `sync::Future` - futures as-is have yet to be deeply re-evaluated with the recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time comes. [breaking-change]
This commit is contained in:
parent
cd614164e6
commit
f3a7ec7028
44 changed files with 168 additions and 237 deletions
|
@ -8,13 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use prelude::*;
|
||||
|
||||
use alloc::arc::Arc;
|
||||
use libc;
|
||||
use c_str::CString;
|
||||
use mem;
|
||||
use sync::{atomic, Mutex};
|
||||
use io::{mod, IoResult, IoError};
|
||||
use prelude::*;
|
||||
|
||||
use sys::{mod, timer, retry, c, set_nonblocking, wouldblock};
|
||||
use sys::fs::{fd_t, FileDesc};
|
||||
|
@ -117,9 +118,6 @@ pub struct UnixStream {
|
|||
write_deadline: u64,
|
||||
}
|
||||
|
||||
unsafe impl Send for UnixStream {}
|
||||
unsafe impl Sync for UnixStream {}
|
||||
|
||||
impl UnixStream {
|
||||
pub fn connect(addr: &CString,
|
||||
timeout: Option<u64>) -> IoResult<UnixStream> {
|
||||
|
@ -218,6 +216,7 @@ pub struct UnixListener {
|
|||
path: CString,
|
||||
}
|
||||
|
||||
// we currently own the CString, so these impls should be safe
|
||||
unsafe impl Send for UnixListener {}
|
||||
unsafe impl Sync for UnixListener {}
|
||||
|
||||
|
@ -265,9 +264,6 @@ struct AcceptorInner {
|
|||
closed: atomic::AtomicBool,
|
||||
}
|
||||
|
||||
unsafe impl Send for AcceptorInner {}
|
||||
unsafe impl Sync for AcceptorInner {}
|
||||
|
||||
impl UnixAcceptor {
|
||||
pub fn fd(&self) -> fd_t { self.inner.listener.fd() }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue