Skip to content

Commit

Permalink
Merge pull request #1296 from romanstingler/once_cell
Browse files Browse the repository at this point in the history
remove once_cell::sync::Lazy for std::sync::LazyLock
  • Loading branch information
Morganamilo authored Dec 27, 2024
2 parents e41fd3a + 1091274 commit ce0ea88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ use std::time::Duration;

use anyhow::{bail, Context, Result};
use log::debug;
use once_cell::sync::Lazy;
use signal_hook::consts::signal::*;
use signal_hook::flag as signal_flag;
use std::sync::LazyLock;
use tr::tr;

pub static DEFAULT_SIGNALS: Lazy<Arc<AtomicBool>> = Lazy::new(|| {
pub static DEFAULT_SIGNALS: LazyLock<Arc<AtomicBool>> = LazyLock::new(|| {
let arc = Arc::new(AtomicBool::new(true));
signal_flag::register_conditional_default(SIGTERM, Arc::clone(&arc)).unwrap();
signal_flag::register_conditional_default(SIGINT, Arc::clone(&arc)).unwrap();
signal_flag::register_conditional_default(SIGQUIT, Arc::clone(&arc)).unwrap();
arc
});

static CAUGHT_SIGNAL: Lazy<Arc<AtomicUsize>> = Lazy::new(|| {
static CAUGHT_SIGNAL: LazyLock<Arc<AtomicUsize>> = LazyLock::new(|| {
let arc = Arc::new(AtomicUsize::new(0));
signal_flag::register_usize(SIGTERM, Arc::clone(&arc), SIGTERM as usize).unwrap();
signal_flag::register_usize(SIGINT, Arc::clone(&arc), SIGINT as usize).unwrap();
signal_flag::register_usize(SIGQUIT, Arc::clone(&arc), SIGQUIT as usize).unwrap();
arc
});

pub static RAISE_SIGPIPE: Lazy<Arc<AtomicBool>> = Lazy::new(|| {
pub static RAISE_SIGPIPE: LazyLock<Arc<AtomicBool>> = LazyLock::new(|| {
let arc = Arc::new(AtomicBool::new(true));
signal_flag::register_conditional_default(SIGPIPE, Arc::clone(&arc)).unwrap();
arc
Expand Down

0 comments on commit ce0ea88

Please sign in to comment.