mittens_engine/engine/repl/
mod.rs1pub mod color;
2pub mod pipe;
3pub mod repl;
4pub mod repl_backend;
5pub mod util;
6
7pub use repl::Repl;
8pub use repl_backend::ReplBackend;
9
10use std::sync::atomic::{AtomicBool, Ordering};
11static STDIN_REPL_ACTIVE: AtomicBool = AtomicBool::new(false);
12
13pub(crate) fn claim_stdin() -> Result<(), &'static str> {
14 if STDIN_REPL_ACTIVE.swap(true, Ordering::AcqRel) {
15 Err("an stdin REPL is already active")
16 } else {
17 Ok(())
18 }
19}
20
21pub(crate) fn release_stdin() {
22 STDIN_REPL_ACTIVE.store(false, Ordering::Release);
23}