1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:57:47 +00:00

Kernel/AHCI: Simplify wait and timeout pattern significantly

Instead of repeating ourselves with the pattern of waiting for some
condition to be met, we can have a general method for this task,
and then we can provide the retry count, the required delay and a lambda
function for the checked condition.
This commit is contained in:
Liav A 2021-11-13 14:20:48 +02:00 committed by Andreas Kling
parent 557351724a
commit 0e5983e603
2 changed files with 26 additions and 22 deletions

View file

@ -99,6 +99,8 @@ private:
ALWAYS_INLINE bool is_interface_disabled() const { return (m_port_registers.ssts & 0xf) == 4; };
ALWAYS_INLINE void wait_until_condition_met_or_timeout(size_t delay_in_microseconds, size_t retries, Function<bool(void)> condition_being_met) const;
// Data members
EntropySource m_entropy_source;