Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove once_cell::sync::Lazy for std::sync::LazyLock #1296

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading