1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-05 16:41:01 +01:00

libutil/signals: Get rid of setInterruptThrown

The interrupting code is no longer relevant. Since
054be50257 logging no longer checks for interrupts
and in general logging should be noexcept.

Co-authored-by: Alois Wohlschlager <alois1@gmx-topmail.de>
Cherry-picked-from: https://gerrit.lix.systems/c/lix/+/1097
This commit is contained in:
Sergei Zimmerman 2025-12-02 00:59:49 +03:00
parent 048a58d331
commit c0c1bde506
No known key found for this signature in database
5 changed files with 10 additions and 31 deletions

View file

@ -12,24 +12,14 @@ using namespace unix;
std::atomic<bool> unix::_isInterrupted = false;
namespace unix {
static thread_local bool interruptThrown = false;
}
thread_local std::function<bool()> unix::interruptCheck;
void setInterruptThrown()
{
unix::interruptThrown = true;
}
void unix::_interrupted()
{
/* Block user interrupts while an exception is being handled.
Throwing an exception while another exception is being handled
kills the program! */
if (!interruptThrown && !std::uncaught_exceptions()) {
interruptThrown = true;
if (!std::uncaught_exceptions()) {
throw Interrupted("interrupted by the user");
}
}