Skip to content

Commit c5a276f

Browse files
committed
refactor: expose test module
1 parent 88185e0 commit c5a276f

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

src/deps/ctrlc/mod.rs

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,6 @@
77
// notice may not be copied, modified, or distributed except
88
// according to those terms.
99

10-
//! Cross platform handling of Ctrl-C signals.
11-
//!
12-
//! [HandlerRoutine]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms683242.aspx
13-
//!
14-
//! [set_handler()](fn.set_handler.html) allows setting a handler closure which is executed on
15-
//! `Ctrl+C`. On Unix, this corresponds to a `SIGINT` signal. On windows, `Ctrl+C` corresponds to
16-
//! [`CTRL_C_EVENT`][HandlerRoutine] or [`CTRL_BREAK_EVENT`][HandlerRoutine].
17-
//!
18-
//! Setting a handler will start a new dedicated signal handling thread where we
19-
//! execute the handler each time we receive a `Ctrl+C` signal. There can only be
20-
//! one handler, you would typically set one at the start of your program.
21-
//!
22-
//! This package was further modified for stacks-blockchain to handle SIGBUS in order to gracefully
23-
//! shut down the node in the event of a sqlite memory error.
24-
//!
25-
//! # Example
26-
//! ```no_run
27-
//! use std::sync::atomic::{AtomicBool, Ordering};
28-
//! use std::sync::Arc;
29-
//!
30-
//! fn main() {
31-
//! let running = Arc::new(AtomicBool::new(true));
32-
//! let r = running.clone();
33-
//!
34-
//! ctrlc::set_handler(move || {
35-
//! r.store(false, Ordering::SeqCst);
36-
//! }).expect("Error setting Ctrl-C handler");
37-
//!
38-
//! println!("Waiting for Ctrl-C...");
39-
//! while running.load(Ordering::SeqCst) {}
40-
//! println!("Got it! Exiting...");
41-
//! }
42-
//! ```
43-
//!
44-
4510
#[macro_use]
4611

4712
mod error;
@@ -50,6 +15,9 @@ pub use self::error::Error;
5015
use std::sync::atomic::{AtomicBool, Ordering};
5116
use std::thread;
5217

18+
#[cfg(test)]
19+
mod tests;
20+
5321
#[derive(PartialEq, Clone)]
5422
#[repr(u8)]
5523
pub enum SignalId {

0 commit comments

Comments
 (0)