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
// Copyright 2026 Photon Ring Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0
//! A shared shutdown signal for coordinating graceful termination of
//! consumer loops.
use Arc;
use ;
/// A shared shutdown signal for coordinating graceful termination.
///
/// ```
/// use photon_ring::Shutdown;
///
/// let shutdown = Shutdown::new();
/// let flag = shutdown.clone();
///
/// // In consumer thread:
/// // while !flag.is_shutdown() {
/// // match sub.try_recv() {
/// // Ok(v) => { /* process */ }
/// // Err(_) => core::hint::spin_loop(),
/// // }
/// // }
///
/// // In main thread:
/// shutdown.trigger();
/// assert!(flag.is_shutdown());
/// ```