Migrate from lazy_static to once_cell

This commit is contained in:
James Liu 2022-06-08 11:50:26 -07:00 committed by GitHub
parent 4c39b3188c
commit 2c01e9e747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 477 additions and 519 deletions

View file

@ -1,5 +1,6 @@
use std::os::raw::*;
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use super::{
@ -18,9 +19,7 @@ use crate::{
// Used for testing. This should always be committed as false.
const DISABLE_MONITOR_LIST_CACHING: bool = false;
lazy_static! {
static ref MONITORS: Mutex<Option<Vec<MonitorHandle>>> = Mutex::default();
}
static MONITORS: Lazy<Mutex<Option<Vec<MonitorHandle>>>> = Lazy::new(Mutex::default);
pub fn invalidate_cached_monitor_list() -> Option<Vec<MonitorHandle>> {
// We update this lazily.