sync: Make Lock more similar to std::sync::Mutex (#1573)

This renames `Lock` to `Mutex`, and brings the API more in line with `std::sync::Mutex`.

In partcular, locking now only takes `&self`, with the expectation that you place the `Mutex` in an `Arc` (or something similar) to share it between threads.

Fixes #1544.
Part of #1210.
This commit is contained in:
Jon Gjengset
2019-09-19 11:46:52 -04:00
committed by GitHub
parent d1f60ac4c6
commit e3415d8d61
6 changed files with 168 additions and 195 deletions
+2 -2
View File
@@ -29,13 +29,13 @@ macro_rules! if_fuzz {
}}
}
mod lock;
mod loom;
pub mod mpsc;
mod mutex;
pub mod oneshot;
pub mod semaphore;
mod task;
pub mod watch;
pub use lock::{Lock, LockGuard};
pub use mutex::{Mutex, MutexGuard};
pub use task::AtomicWaker;