mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:57:44 +00:00
Kernel: Use SpinlockProtected list in SharedIRQHandler
Adding handlers to the SharedIRQHandler without any lock is not thread safe. Use SpinlockProtected list instead.
This commit is contained in:
parent
fd8a154f8c
commit
756a73471e
2 changed files with 17 additions and 12 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <Kernel/Arch/IRQController.h>
|
||||
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Locking/SpinlockProtected.h>
|
||||
|
||||
namespace Kernel {
|
||||
class IRQHandler;
|
||||
|
@ -27,7 +28,10 @@ public:
|
|||
|
||||
void enumerate_handlers(Function<void(GenericInterruptHandler&)>&);
|
||||
|
||||
virtual size_t sharing_devices_count() const override { return m_handlers.size_slow(); }
|
||||
virtual size_t sharing_devices_count() const override
|
||||
{
|
||||
return m_handlers.with([](auto& list) { return list.size_slow(); });
|
||||
}
|
||||
virtual bool is_shared_handler() const override { return true; }
|
||||
virtual bool is_sharing_with_others() const override { return false; }
|
||||
|
||||
|
@ -40,7 +44,7 @@ private:
|
|||
void disable_interrupt_vector();
|
||||
explicit SharedIRQHandler(u8 interrupt_number);
|
||||
bool m_enabled { true };
|
||||
GenericInterruptHandler::List m_handlers;
|
||||
SpinlockProtected<GenericInterruptHandler::List, LockRank::None> m_handlers;
|
||||
NonnullLockRefPtr<IRQController> m_responsible_irq_controller;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue