Skip to content

Commit

Permalink
remove once_cell::sync::Lazy for std::sync::LazyLock
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Stingler committed Dec 17, 2024
1 parent 9e3c83a commit a15bee7
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 a15bee7

Please sign in to comment.