39 bool isLocked()
const {
return locked_.load(std::memory_order_acquire); }
49 const char*
getDetail()
const {
return detail_.load(std::memory_order_acquire); }
75 [[noreturn]]
void performShutdown();
77 std::atomic<bool> locked_{
false};
79 std::atomic<const char*> detail_{
nullptr};
80 std::atomic<ShutdownHandler> handler_{
nullptr};
void triggerLockdown(LockdownReason reason, const char *detail=nullptr)
Latches the lockdown flag. Idempotent and ISR-safe.
void(*)(LockdownReason reason, const char *detail) ShutdownHandler
UI handler invoked from main context just before deep sleep.
bool isLocked() const
Returns true once a lockdown has been latched.
LockdownReason getReason() const
Reason captured at the first triggerLockdown call.
void enforceIfLocked()
If locked, runs the shutdown sequence and never returns. Otherwise returns immediately....
static SystemLock & instance()
Returns the process-wide lockdown latch singleton.
const char * getDetail() const
Returns the optional detail string captured at the first triggerLockdown call, or nullptr if none was...
void setShutdownHandler(ShutdownHandler handler)
Installs an optional UI handler invoked just before deep sleep. Must be set from main task before mai...
LockdownReason
Reason the system entered lockdown.