Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock

This commit is contained in:
Maybe Waffle 2022-06-16 19:39:39 +04:00
parent 7c360dc117
commit c1a2db3372
32 changed files with 847 additions and 819 deletions

View file

@ -1,5 +1,5 @@
pub use jobserver_crate::Client;
use std::lazy::SyncLazy;
use std::sync::LazyLock;
// We can only call `from_env` once per process
@ -18,7 +18,7 @@ use std::lazy::SyncLazy;
// Also note that we stick this in a global because there could be
// multiple rustc instances in this process, and the jobserver is
// per-process.
static GLOBAL_CLIENT: SyncLazy<Client> = SyncLazy::new(|| unsafe {
static GLOBAL_CLIENT: LazyLock<Client> = LazyLock::new(|| unsafe {
Client::from_env().unwrap_or_else(|| {
let client = Client::new(32).expect("failed to create jobserver");
// Acquire a token for the main thread which we can release later

View file

@ -258,7 +258,7 @@ cfg_if! {
pub use parking_lot::MutexGuard as LockGuard;
pub use parking_lot::MappedMutexGuard as MappedLockGuard;
pub use std::lazy::SyncOnceCell as OnceCell;
pub use std::sync::OnceLock as OnceCell;
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};