meso: invert process<>thread header deps

This commit is contained in:
TuxSH 2018-11-15 12:14:19 +01:00 committed by Michael Scire
parent 91662decf0
commit 1a924ad317
4 changed files with 33 additions and 11 deletions

View file

@ -7,13 +7,14 @@ class KResourceLimit;
#include <mesosphere/core/KSynchronizationObject.hpp> #include <mesosphere/core/KSynchronizationObject.hpp>
#include <mesosphere/interfaces/ISetAllocated.hpp> #include <mesosphere/interfaces/ISetAllocated.hpp>
#include <mesosphere/processes/KHandleTable.hpp> #include <mesosphere/processes/KHandleTable.hpp>
#include <mesosphere/threading/KThread.hpp>
namespace mesosphere namespace mesosphere
{ {
class KProcess final : public KSynchronizationObject /* FIXME */ { class KProcess final : public KSynchronizationObject /* FIXME */ {
public: public:
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Process); MESOSPHERE_AUTO_OBJECT_TRAITS(SynchronizationObject, Process);
enum class State : uint { enum class State : uint {
Created = 0, Created = 0,

View file

@ -6,7 +6,7 @@
#include <mesosphere/core/Handle.hpp> #include <mesosphere/core/Handle.hpp>
#include <mesosphere/core/Result.hpp> #include <mesosphere/core/Result.hpp>
#include <mesosphere/core/KSynchronizationObject.hpp> #include <mesosphere/core/KSynchronizationObject.hpp>
#include <mesosphere/processes/KProcess.hpp> #include <mesosphere/interfaces/ISetAllocated.hpp>
#include <mesosphere/interfaces/IAlarmable.hpp> #include <mesosphere/interfaces/IAlarmable.hpp>
#include <mesosphere/interfaces/ILimitedResource.hpp> #include <mesosphere/interfaces/ILimitedResource.hpp>
@ -144,18 +144,13 @@ class KThread final :
} }
KProcess *GetOwner() const { return owner; } KProcess *GetOwner() const { return owner; }
bool IsSchedulerOperationRedundant() const { return owner != nullptr && owner->GetSchedulerOperationCount() == redundantSchedulerOperationCount; } bool IsSchedulerOperationRedundant() const;
void IncrementSchedulerOperationCount() { if (owner != nullptr) owner->IncrementSchedulerOperationCount(); } void IncrementSchedulerOperationCount();
void SetRedundantSchedulerOperation() { redundantSchedulerOperationCount = owner != nullptr ? owner->GetSchedulerOperationCount() : redundantSchedulerOperationCount; } void SetRedundantSchedulerOperation();
void SetCurrentCoreId(int coreId) { currentCoreId = coreId; } void SetCurrentCoreId(int coreId) { currentCoreId = coreId; }
void SetProcessLastThreadAndIdleSelectionCount(ulong idleSelectionCount) void SetProcessLastThreadAndIdleSelectionCount(ulong idleSelectionCount);
{
if (owner != nullptr) {
owner->SetLastThreadAndIdleSelectionCount(this, idleSelectionCount);
}
}
void UpdateLastScheduledTime() { ++lastScheduledTime; /* FIXME */} void UpdateLastScheduledTime() { ++lastScheduledTime; /* FIXME */}

View file

@ -2,6 +2,7 @@
#include <algorithm> #include <algorithm>
#include <mesosphere/processes/KHandleTable.hpp> #include <mesosphere/processes/KHandleTable.hpp>
#include <mesosphere/threading/KThread.hpp> #include <mesosphere/threading/KThread.hpp>
#include <mesosphere/processes/KProcess.hpp>
namespace mesosphere namespace mesosphere
{ {

View file

@ -3,6 +3,7 @@
#include <algorithm> #include <algorithm>
#include <mesosphere/threading/KThread.hpp> #include <mesosphere/threading/KThread.hpp>
#include <mesosphere/processes/KProcess.hpp>
#include <mesosphere/threading/KScopedCriticalSection.hpp> #include <mesosphere/threading/KScopedCriticalSection.hpp>
namespace mesosphere namespace mesosphere
@ -13,6 +14,30 @@ void KThread::OnAlarm()
CancelKernelSync(); CancelKernelSync();
} }
bool KThread::IsSchedulerOperationRedundant() const
{
return owner != nullptr && owner->GetSchedulerOperationCount() == redundantSchedulerOperationCount;
}
void KThread::IncrementSchedulerOperationCount()
{
if (owner != nullptr) {
owner->IncrementSchedulerOperationCount();
}
}
void KThread::SetRedundantSchedulerOperation()
{
redundantSchedulerOperationCount = owner != nullptr ? owner->GetSchedulerOperationCount() : redundantSchedulerOperationCount;
}
void KThread::SetProcessLastThreadAndIdleSelectionCount(ulong idleSelectionCount)
{
if (owner != nullptr) {
owner->SetLastThreadAndIdleSelectionCount(this, idleSelectionCount);
}
}
void KThread::AdjustScheduling(ushort oldMaskFull) void KThread::AdjustScheduling(ushort oldMaskFull)
{ {
if (currentSchedMaskFull == oldMaskFull) { if (currentSchedMaskFull == oldMaskFull) {