mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
Fix FindObject
This commit is contained in:
parent
6642373795
commit
240f455bc0
3 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <boost/intrusive/set.hpp>
|
#include <boost/intrusive/set.hpp>
|
||||||
#include <mesosphere/core/util.hpp>
|
#include <mesosphere/core/util.hpp>
|
||||||
#include <mesosphere/core/KAutoObject.hpp>
|
|
||||||
#include <mesosphere/kresources/KSlabHeap.hpp>
|
#include <mesosphere/kresources/KSlabHeap.hpp>
|
||||||
#include <mesosphere/threading/KMutex.hpp>
|
#include <mesosphere/threading/KMutex.hpp>
|
||||||
|
|
||||||
|
@ -38,7 +37,6 @@ class KObjectAllocator {
|
||||||
T,
|
T,
|
||||||
boost::intrusive::base_hook<AllocatedSetHookType>,
|
boost::intrusive::base_hook<AllocatedSetHookType>,
|
||||||
boost::intrusive::compare<Comparator>
|
boost::intrusive::compare<Comparator>
|
||||||
//boost::intrusive::key_of_value<KeyOfValue>
|
|
||||||
>::type;
|
>::type;
|
||||||
|
|
||||||
using pointer = T *;
|
using pointer = T *;
|
||||||
|
@ -71,8 +69,9 @@ class KObjectAllocator {
|
||||||
allocatedSet.erase(obj);
|
allocatedSet.erase(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
T *FindObject(u64 comparisonKey)
|
SharedPtr<T> FindObject(u64 comparisonKey) noexcept
|
||||||
{
|
{
|
||||||
|
std::scoped_lock guard{mutex};
|
||||||
auto it = allocatedSet.find(comparisonKey, ComparatorEqual{});
|
auto it = allocatedSet.find(comparisonKey, ComparatorEqual{});
|
||||||
return it != allocatedSet.end() ? &*it : nullptr;
|
return it != allocatedSet.end() ? &*it : nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <mesosphere/core/util.hpp>
|
#include <mesosphere/core/util.hpp>
|
||||||
#include <mesosphere/core/Result.hpp>
|
#include <mesosphere/core/Result.hpp>
|
||||||
|
#include <mesosphere/core/KAutoObject.hpp>
|
||||||
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
||||||
#include <mesosphere/interfaces/ILimitedResource.hpp>
|
#include <mesosphere/interfaces/ILimitedResource.hpp>
|
||||||
#include <mesosphere/interfaces/IClientServerParent.hpp>
|
#include <mesosphere/interfaces/IClientServerParent.hpp>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <mesosphere/core/util.hpp>
|
#include <mesosphere/core/util.hpp>
|
||||||
#include <mesosphere/core/Result.hpp>
|
#include <mesosphere/core/Result.hpp>
|
||||||
|
#include <mesosphere/core/KAutoObject.hpp>
|
||||||
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
||||||
#include <mesosphere/interfaces/IServer.hpp>
|
#include <mesosphere/interfaces/IServer.hpp>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue