Kernel: Migrate ARP table locking to ProtectedValue

This commit is contained in:
Jean-Baptiste Boric 2021-07-18 10:30:27 +02:00 committed by Andreas Kling
commit 738e604bfc
Notes: sideshowbarker 2024-07-18 07:20:33 +09:00
3 changed files with 27 additions and 20 deletions

View file

@ -76,12 +76,11 @@ private:
virtual bool output(KBufferBuilder& builder) override
{
JsonArraySerializer array { builder };
MutexLocker locker(arp_table().lock(), Mutex::Mode::Shared);
for (auto& it : arp_table().resource()) {
arp_table().for_each_shared([&](const auto& it) {
auto obj = array.add_object();
obj.add("mac_address", it.value.to_string());
obj.add("ip_address", it.key.to_string());
}
});
array.finish();
return true;
}