Do the same for ILimitedResource; fix handle table def, for the moment
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <mesosphere/core/KAutoObject.hpp>
|
||||
#include <tuple>
|
||||
|
||||
#define MESOSPHERE_LIMITED_RESOURCE_TRAITS(maxTime) static constexpr auto maxResourceAcqWaitTime = maxTime;
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
@@ -15,12 +17,10 @@ void ReleaseResource(const SharedPtr<KResourceLimit> &reslimit, KAutoObject::Typ
|
||||
|
||||
}
|
||||
|
||||
template<typename Derived, uint maxResourceAcqWaitTimeMsec = 1000u>
|
||||
template<typename Derived>
|
||||
class ILimitedResource {
|
||||
public:
|
||||
|
||||
static constexpr auto maxResourceAcqWaitTime = maxResourceAcqWaitTimeMsec * 1ms;
|
||||
|
||||
const SharedPtr<KProcess>& GetResourceOwner() const { return resourceOwner; }
|
||||
void SetResourceOwner(SharedPtr<KProcess> owner)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ class KEvent final :
|
||||
public:
|
||||
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Event);
|
||||
MESOSPHERE_CLIENT_SERVER_PARENT_TRAITS(ReadableEvent, WritableEvent);
|
||||
MESOSPHERE_LIMITED_RESOURCE_TRAITS(1s);
|
||||
|
||||
virtual ~KEvent();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <mesosphere/core/util.hpp>
|
||||
#include <mesosphere/core/Handle.hpp>
|
||||
#include <mesosphere/core/Result.hpp>
|
||||
#include <mesosphere/core/KAutoObject.hpp>
|
||||
#include <mesosphere/arch/KSpinLock.hpp>
|
||||
#include <array>
|
||||
@@ -46,7 +47,8 @@ class KHandleTable final {
|
||||
constexpr size_t GetSize() const { return size; }
|
||||
constexpr size_t GetCapacity() const { return capacity; }
|
||||
|
||||
KHandleTable(size_t capacity);
|
||||
Result Initialize(size_t capacity); // TODO: implement!
|
||||
|
||||
~KHandleTable();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,6 +6,7 @@ class KResourceLimit;
|
||||
#include <mesosphere/core/util.hpp>
|
||||
#include <mesosphere/core/KAutoObject.hpp>
|
||||
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
||||
#include <mesosphere/processes/KHandleTable.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
@@ -28,6 +29,7 @@ class KProcess : public KAutoObject {
|
||||
long schedulerOperationCount = -1;
|
||||
|
||||
SharedPtr<KResourceLimit> reslimit{};
|
||||
KHandleTable handleTable{};
|
||||
};
|
||||
|
||||
inline void intrusive_ptr_add_ref(KProcess *obj)
|
||||
|
||||
@@ -22,7 +22,7 @@ using ThreadMutexWaitListBaseHook = boost::intrusive::list_base_hook<boost::int
|
||||
|
||||
class KThread final :
|
||||
public KAutoObject,
|
||||
public ILimitedResource<KThread, 100u>,
|
||||
public ILimitedResource<KThread>,
|
||||
public ISetAllocated<KThread>,
|
||||
public IAlarmable,
|
||||
public ThreadWaitListBaseHook,
|
||||
@@ -31,6 +31,7 @@ class KThread final :
|
||||
public:
|
||||
|
||||
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Thread);
|
||||
MESOSPHERE_LIMITED_RESOURCE_TRAITS(100ms);
|
||||
|
||||
class StackParameters {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user