mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel: Use AK::NeverDestroyed<Timer> to store the timer class
For an upcoming change to support interrupts in this driver, this class has to inherit from IRQHandler. That in turn will make this class virtual, which will then actually call the destructor of the class. We don't want this to happen, thus we have to wrap the class in a AK::NeverDestroyed.
This commit is contained in:
parent
a0b0c4e723
commit
8b77c61e7d
Notes:
sideshowbarker
2024-07-17 10:30:27 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/8b77c61e7d Pull-request: https://github.com/SerenityOS/serenity/pull/14146 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico ✅
2 changed files with 4 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/NeverDestroyed.h>
|
||||
#include <Kernel/Arch/aarch64/RPi/MMIO.h>
|
||||
#include <Kernel/Arch/aarch64/RPi/Mailbox.h>
|
||||
#include <Kernel/Arch/aarch64/RPi/Timer.h>
|
||||
|
@ -35,8 +36,8 @@ Timer::Timer()
|
|||
|
||||
Timer& Timer::the()
|
||||
{
|
||||
static Timer instance;
|
||||
return instance;
|
||||
static AK::NeverDestroyed<Timer> instance;
|
||||
return *instance;
|
||||
}
|
||||
|
||||
u64 Timer::microseconds_since_boot()
|
||||
|
|
|
@ -14,6 +14,7 @@ struct TimerRegisters;
|
|||
|
||||
class Timer {
|
||||
public:
|
||||
Timer();
|
||||
static Timer& the();
|
||||
|
||||
u64 microseconds_since_boot();
|
||||
|
@ -38,8 +39,6 @@ public:
|
|||
static u32 set_clock_rate(ClockID, u32 rate_hz, bool skip_setting_turbo = true);
|
||||
|
||||
private:
|
||||
Timer();
|
||||
|
||||
TimerRegisters volatile* m_registers;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue