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
//! CompactionGuard RAII type for the dream cycle.
//!
//! Why: Extracted from dream.rs to keep each file under the 500-SLOC cap
//! (#607). The guard ensures the `is_compacting` flag is always cleared on
//! exit, even on early errors or panics.
//! What: `CompactionGuard` sets `is_compacting = true` on construction and
//! clears it on drop.
//! Test: `dream::tests::dream_cycle_toggles_is_compacting`.
use Arc;
use ;
/// RAII guard that toggles a palace's `is_compacting` flag for the lifetime
/// of a dream cycle.
///
/// Why: A plain `flag.store(true)` at the top of `dream_cycle` and
/// `flag.store(false)` at the bottom leaks `true` if any pass returns an
/// error or panics, leaving the dashboard stuck on "dreaming". A Drop guard
/// guarantees the flag clears on every exit path.
/// What: Stores `true` in the supplied `AtomicBool` on construction and
/// `false` on drop, both with `Relaxed` ordering (the dashboard read path
/// uses the same ordering — exact happens-before semantics across tasks are
/// not required for a UI indicator).
/// Test: `dream::tests::dream_cycle_toggles_is_compacting`.
pub