From 240f455bc05583ede9fb349964321163824b5bd1 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 19 Nov 2018 11:52:03 +0100 Subject: [PATCH] Fix FindObject --- .../include/mesosphere/kresources/KObjectAllocator.hpp | 5 ++--- mesosphere/include/mesosphere/processes/KEvent.hpp | 1 + mesosphere/include/mesosphere/processes/KWritableEvent.hpp | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mesosphere/include/mesosphere/kresources/KObjectAllocator.hpp b/mesosphere/include/mesosphere/kresources/KObjectAllocator.hpp index a26faef7b..3dcc75008 100644 --- a/mesosphere/include/mesosphere/kresources/KObjectAllocator.hpp +++ b/mesosphere/include/mesosphere/kresources/KObjectAllocator.hpp @@ -1,7 +1,6 @@ #pragma once #include #include -#include #include #include @@ -38,7 +37,6 @@ class KObjectAllocator { T, boost::intrusive::base_hook, boost::intrusive::compare - //boost::intrusive::key_of_value >::type; using pointer = T *; @@ -71,8 +69,9 @@ class KObjectAllocator { allocatedSet.erase(obj); } - T *FindObject(u64 comparisonKey) + SharedPtr FindObject(u64 comparisonKey) noexcept { + std::scoped_lock guard{mutex}; auto it = allocatedSet.find(comparisonKey, ComparatorEqual{}); return it != allocatedSet.end() ? &*it : nullptr; } diff --git a/mesosphere/include/mesosphere/processes/KEvent.hpp b/mesosphere/include/mesosphere/processes/KEvent.hpp index 16891c1b5..3559710a9 100644 --- a/mesosphere/include/mesosphere/processes/KEvent.hpp +++ b/mesosphere/include/mesosphere/processes/KEvent.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include diff --git a/mesosphere/include/mesosphere/processes/KWritableEvent.hpp b/mesosphere/include/mesosphere/processes/KWritableEvent.hpp index a2e0ad2f4..e57d79c77 100644 --- a/mesosphere/include/mesosphere/processes/KWritableEvent.hpp +++ b/mesosphere/include/mesosphere/processes/KWritableEvent.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include