1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:28:11 +00:00

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
parent 75260bff92
commit 738e604bfc
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;
}