summaryrefslogtreecommitdiffstats
path: root/src/repl/abort.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-11-02 09:53:54 +0800
committerGitHub <noreply@github.com>2023-11-02 09:53:54 +0800
commit444f4ebe9de8aa68afdf8d39b734a8543b9b5c4b (patch)
treed8b0e16faa0270fda2a6c7afa5fe18c1970b9a93 /src/repl/abort.rs
parent5c7bfd92ff3e557477969be9db0638ef0d3d3659 (diff)
downloadaichat-444f4ebe9de8aa68afdf8d39b734a8543b9b5c4b.tar.gz
refactor: improve code quanity (#196)
- rewrite Repl, remove ReplHandler - move ReplyStreamHandler to repl/ and rename it to ReplyHandler - deprecate utils::print_now - refactor session info
Diffstat (limited to 'src/repl/abort.rs')
-rw-r--r--src/repl/abort.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/repl/abort.rs b/src/repl/abort.rs
index f76abb6..af58b35 100644
--- a/src/repl/abort.rs
+++ b/src/repl/abort.rs
@@ -3,15 +3,19 @@ use std::sync::{
Arc,
};
-pub type SharedAbortSignal = Arc<AbortSignal>;
+pub type AbortSignal = Arc<AbortSignalInner>;
-pub struct AbortSignal {
+pub struct AbortSignalInner {
ctrlc: AtomicBool,
ctrld: AtomicBool,
}
-impl AbortSignal {
- pub fn new() -> SharedAbortSignal {
+pub fn create_abort_signal() -> AbortSignal {
+ AbortSignalInner::new()
+}
+
+impl AbortSignalInner {
+ pub fn new() -> AbortSignal {
Arc::new(Self {
ctrlc: AtomicBool::new(false),
ctrld: AtomicBool::new(false),