mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-02 07:38:57 +08:00
Rename sigchecker_t to Sigchecker
This matches Rust naming conventions
This commit is contained in:
parent
2848be6b73
commit
603a2d6973
@ -5,7 +5,7 @@ use crate::builtins::shared::{
|
|||||||
STATUS_CMD_OK, STATUS_INVALID_ARGS,
|
STATUS_CMD_OK, STATUS_INVALID_ARGS,
|
||||||
};
|
};
|
||||||
use crate::ffi::{job_t, parser_t, proc_wait_any, Repin};
|
use crate::ffi::{job_t, parser_t, proc_wait_any, Repin};
|
||||||
use crate::signal::sigchecker_t;
|
use crate::signal::Sigchecker;
|
||||||
use crate::wait_handle::{WaitHandleRef, WaitHandleStore};
|
use crate::wait_handle::{WaitHandleRef, WaitHandleStore};
|
||||||
use crate::wchar::{widestrs, wstr};
|
use crate::wchar::{widestrs, wstr};
|
||||||
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
|
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
|
||||||
@ -112,7 +112,7 @@ fn wait_for_completion(
|
|||||||
return Some(0);
|
return Some(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut sigint = sigchecker_t::new_sighupint();
|
let mut sigint = Sigchecker::new_sighupint();
|
||||||
loop {
|
loop {
|
||||||
let finished = if any_flag {
|
let finished = if any_flag {
|
||||||
whs.iter().any(is_completed)
|
whs.iter().any(is_completed)
|
||||||
|
@ -10,7 +10,7 @@ use crate::global_safety::RelaxedAtomicBool;
|
|||||||
use crate::job_group::JobGroup;
|
use crate::job_group::JobGroup;
|
||||||
use crate::path::path_apply_working_directory;
|
use crate::path::path_apply_working_directory;
|
||||||
use crate::redirection::{RedirectionMode, RedirectionSpecList};
|
use crate::redirection::{RedirectionMode, RedirectionSpecList};
|
||||||
use crate::signal::sigchecker_t;
|
use crate::signal::Sigchecker;
|
||||||
use crate::topic_monitor::topic_t;
|
use crate::topic_monitor::topic_t;
|
||||||
use crate::wchar::{wstr, WString, L};
|
use crate::wchar::{wstr, WString, L};
|
||||||
use crate::wutil::{perror, wdirname, wstat, wwrite_to_fd};
|
use crate::wutil::{perror, wdirname, wstat, wwrite_to_fd};
|
||||||
@ -789,7 +789,7 @@ pub struct FdOutputStream {
|
|||||||
fd: RawFd,
|
fd: RawFd,
|
||||||
|
|
||||||
/// Used to check if a SIGINT has been received when EINTR is encountered
|
/// Used to check if a SIGINT has been received when EINTR is encountered
|
||||||
sigcheck: sigchecker_t,
|
sigcheck: Sigchecker,
|
||||||
|
|
||||||
/// Whether we have received an error.
|
/// Whether we have received an error.
|
||||||
errored: bool,
|
errored: bool,
|
||||||
@ -800,7 +800,7 @@ impl FdOutputStream {
|
|||||||
assert!(fd >= 0, "Invalid fd");
|
assert!(fd >= 0, "Invalid fd");
|
||||||
FdOutputStream {
|
FdOutputStream {
|
||||||
fd,
|
fd,
|
||||||
sigcheck: sigchecker_t::new(topic_t::sighupint),
|
sigcheck: Sigchecker::new(topic_t::sighupint),
|
||||||
errored: false,
|
errored: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,23 +8,23 @@ use crate::wchar_ffi::c_str;
|
|||||||
use widestring::U32CStr;
|
use widestring::U32CStr;
|
||||||
use widestring_suffix::widestrs;
|
use widestring_suffix::widestrs;
|
||||||
|
|
||||||
/// A sigint_detector_t can be used to check if a SIGINT (or SIGHUP) has been delivered.
|
/// A Sigchecker can be used to check if a SIGINT (or SIGHUP) has been delivered.
|
||||||
pub struct sigchecker_t {
|
pub struct Sigchecker {
|
||||||
topic: topic_t,
|
topic: topic_t,
|
||||||
gen: generation_t,
|
gen: generation_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl sigchecker_t {
|
impl Sigchecker {
|
||||||
/// Create a new checker for the given topic.
|
/// Create a new checker for the given topic.
|
||||||
pub fn new(topic: topic_t) -> sigchecker_t {
|
pub fn new(topic: topic_t) -> Self {
|
||||||
let mut res = sigchecker_t { topic, gen: 0 };
|
let mut res = Sigchecker { topic, gen: 0 };
|
||||||
// Call check() to update our generation.
|
// Call check() to update our generation.
|
||||||
res.check();
|
res.check();
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new checker for SIGHUP and SIGINT.
|
/// Create a new checker for SIGHUP and SIGINT.
|
||||||
pub fn new_sighupint() -> sigchecker_t {
|
pub fn new_sighupint() -> Self {
|
||||||
Self::new(topic_t::sighupint)
|
Self::new(topic_t::sighupint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user