Kernel: wrap resource limit state into kernel state; pass ref to resource limit

This commit is contained in:
Weiyi Wang 2018-10-13 16:41:34 -04:00
parent 13c26b4371
commit 2a411bb501
7 changed files with 51 additions and 33 deletions

View file

@ -4,6 +4,7 @@
#pragma once
#include <memory>
#include <string>
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include "common/common_types.h"
@ -23,6 +24,7 @@ class ClientPort;
class ServerPort;
class ClientSession;
class ServerSession;
class ResourceLimitList;
enum class ResetType {
OneShot,
@ -116,6 +118,12 @@ public:
*/
std::tuple<SharedPtr<ServerSession>, SharedPtr<ClientSession>> CreateSessionPair(
const std::string& name = "Unknown", SharedPtr<ClientPort> client_port = nullptr);
ResourceLimitList& ResourceLimit();
const ResourceLimitList& ResourceLimit() const;
private:
std::unique_ptr<ResourceLimitList> resource_limits;
};
} // namespace Kernel