1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Async signal handling and graceful shutdown.
//!
//! This module provides primitives for handling Unix signals and implementing
//! graceful shutdown patterns in async applications.
//!
//! # Components
//!
//! - [`SignalKind`]: Enumeration of Unix signal types
//! - [`Signal`]: Async stream for receiving Unix signals
//! - [`ctrl_c`]: Cross-platform Ctrl+C handling
//! - [`ShutdownController`]: Coordinated graceful shutdown
//! - [`ShutdownReceiver`]: Handle for receiving shutdown notifications
//! - [`with_graceful_shutdown`]: Run tasks with shutdown support
//!
//! # Platform Behavior
//!
//! Unix signal streams (`signal(...)`) and `ctrl_c()` are supported through a
//! global signal dispatcher.
//!
//! Windows builds support a subset of process signals (`SIGINT`, `SIGTERM`,
//! and `SIGBREAK` via `SignalKind::quit()`). Other non-Unix builds expose the
//! same API surface but return unsupported errors for signal stream creation.
//!
//! The [`ShutdownController`] and graceful shutdown helpers are fully
//! functional using our sync primitives.
//!
//! # Example
//!
//! ```ignore
//! use asupersync::signal::{ShutdownController, with_graceful_shutdown, GracefulOutcome};
//!
//! async fn run_server() {
//! let controller = ShutdownController::new();
//!
//! // Subscribe to shutdown notifications
//! let receiver = controller.subscribe();
//!
//! // Run a task with graceful shutdown support
//! let result = with_graceful_shutdown(
//! async { /* server loop */ 42 },
//! receiver,
//! ).await;
//!
//! match result {
//! GracefulOutcome::Completed(value) => println!("Completed: {value}"),
//! GracefulOutcome::ShutdownSignaled => println!("Shutdown requested"),
//! }
//! }
//! ```
//!
//! # Cancel Safety
//!
//! - `Signal::recv`: Cancel-safe
//! - `ShutdownReceiver::wait`: Cancel-safe
//! - `ctrl_c`: Cancel-safe
pub use ;
pub use ;
pub use SignalKind;
pub use ;
pub use ;
// Unix-specific signal helpers
pub use ;