Commit Graph
11 Commits
Author SHA1 Message Date
Tamino Bauknecht dd1de3efbf Revert "Revert "Fix potential memory leaks""
This reverts commit 2d33c20231 and
reapplies various patches for memory leaks.
The reason for the revert was a bug for a maximum duration interval
which caused sleep_for() to cause unpredictable behavior.
2023-10-24 17:51:38 +02:00
Tamino Bauknecht 521dac8086 sleeper_thread: Make sleep_for more robust
In the previous fix for a passed max duration, the assumption was made
that at maximum one second will pass between the duration assignment and
the std::condition_variable::sleep_for() call.
This implementation makes the behavior more predictable by using
sleep_until() instead to emulate the sleep_for() behavior.
2023-10-24 17:51:34 +02:00
Tamino Bauknecht ad7d4eb07d sleeper_thread: Allow sleep_for with max duration
The standard library has the implicit requirement that for
std::condition_variable::sleep_for() the duration must not cause an
overflow if added to the current time.
This commit will reduce the duration accordingly to fit into the
duration type.
2023-10-24 17:44:35 +02:00
Tamino Bauknecht f598e348c4 ci: Update Linter job 2023-10-21 12:50:56 +02:00
Tamino Bauknecht 6dd2cfba34 ci: Lint header files with hpp file ending 2023-10-21 11:57:11 +02:00
Tamino Bauknecht ae748b2644 modules+util: fix actual (potential) memory leaks 2023-10-21 11:51:33 +02:00
Tamino Bauknecht a0b63d6b1e modules: use scope_exit for deletion to make code more robust 2023-10-21 11:51:18 +02:00
Tamino Bauknecht 89e85db790 ALabel: make use of std::chrono::max() instead of magic number 2023-10-21 11:50:38 +02:00
Tamino Bauknecht a73669be6a modules/upower: use smart pointer to avoid memory leak 2023-10-21 11:50:28 +02:00
Tamino Bauknecht 8c57756556 util: add scope_guard
This custom small implementation avoids adding an extra dependency like
Boost.ScopeExit
2023-10-21 11:50:06 +02:00
Tamino Bauknecht b8afde043c sleeper_thread: allow interrupting sleep()
This keeps the function consistent with sleep_until() and sleep_for()
which both can be interrupted.
This is relevant to allow an update via a "signal" without an "interval"
in a custom module.
2023-10-20 23:57:54 +02:00