meso: introduce ProcessState

This commit is contained in:
TuxSH
2018-11-15 11:49:32 +01:00
committed by Michael Scire
parent 757aa30e74
commit 529024448e
3 changed files with 57 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ MESOSPHERE_AUTO_OBJECT_FW_DECL(LightServerSession);
MESOSPHERE_AUTO_OBJECT_FW_DECL(Port);
MESOSPHERE_AUTO_OBJECT_FW_DECL(ClientPort);
MESOSPHERE_AUTO_OBJECT_FW_DECL(ServerPort);
MESOSPHERE_AUTO_OBJECT_FW_DECL(Debug);
class KAutoObject {
public:

View File

@@ -4,17 +4,30 @@ class KThread;
class KResourceLimit;
#include <mesosphere/core/util.hpp>
#include <mesosphere/core/KAutoObject.hpp>
#include <mesosphere/core/KSynchronizationObject.hpp>
#include <mesosphere/interfaces/ISetAllocated.hpp>
#include <mesosphere/processes/KHandleTable.hpp>
namespace mesosphere
{
class KProcess final : public KAutoObject {
class KProcess final : public KSynchronizationObject /* FIXME */ {
public:
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Process);
enum class State : uint {
Created = 0,
CreatedAttached,
Started,
Crashed,
StartedAttached,
Exiting,
Exited,
DebugSuspended,
};
virtual bool IsSignaled() const override;
constexpr long GetSchedulerOperationCount() const { return schedulerOperationCount; }
void IncrementSchedulerOperationCount() { ++schedulerOperationCount; }
@@ -24,11 +37,21 @@ class KProcess final : public KAutoObject {
KHandleTable &GetHandleTable() { return handleTable; }
constexpr State GetState() const { return state; }
KDebug *GetDebug() const { return debug; }
void SetDebug(KDebug *debug);
void ClearDebug(State attachState);
private:
KThread *lastThreads[MAX_CORES]{nullptr};
ulong lastIdleSelectionCount[MAX_CORES]{0};
long schedulerOperationCount = -1;
State state = State::Created;
bool stateChanged = false;
KDebug *debug = nullptr;
SharedPtr<KResourceLimit> reslimit{};
KHandleTable handleTable{};
};