Write KEvent::Initialize, fix build issues
This commit is contained in:
@@ -15,7 +15,7 @@ KSynchronizationObject::~KSynchronizationObject()
|
||||
|
||||
void KSynchronizationObject::NotifyWaiters()
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
|
||||
if (IsSignaled()) {
|
||||
for (auto &&waiter : waiters) {
|
||||
|
||||
@@ -5,36 +5,44 @@
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
bool KReadableEvent::IsSignaled() const {
|
||||
return this->is_signaled;
|
||||
|
||||
bool KReadableEvent::IsSignaled() const
|
||||
{
|
||||
return this->isSignaled;
|
||||
}
|
||||
|
||||
Result KReadableEvent::Signal() {
|
||||
KScopedCriticalSection critical_section;
|
||||
KReadableEvent::~KReadableEvent()
|
||||
{
|
||||
}
|
||||
|
||||
Result KReadableEvent::Signal()
|
||||
{
|
||||
KScopedCriticalSection criticalSection{};
|
||||
|
||||
if (!this->is_signaled) {
|
||||
this->is_signaled = true;
|
||||
this->NotifyWaiters();
|
||||
if (!this->isSignaled) {
|
||||
this->isSignaled = true;
|
||||
NotifyWaiters();
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
return ResultSuccess{};
|
||||
}
|
||||
|
||||
Result KReadableEvent::Clear() {
|
||||
this->Reset();
|
||||
|
||||
return ResultSuccess();
|
||||
Result KReadableEvent::Clear()
|
||||
{
|
||||
Reset();
|
||||
|
||||
return ResultSuccess{};
|
||||
}
|
||||
|
||||
Result KReadableEvent::Reset() {
|
||||
KScopedCriticalSection critical_section;
|
||||
|
||||
if (this->is_signaled) {
|
||||
this->is_signaled = false;
|
||||
return ResultSuccess();
|
||||
Result KReadableEvent::Reset()
|
||||
{
|
||||
KScopedCriticalSection criticalSection{};
|
||||
|
||||
if (this->isSignaled) {
|
||||
this->isSignaled = false;
|
||||
return ResultSuccess{};
|
||||
}
|
||||
return ResultKernelInvalidState();
|
||||
return ResultKernelInvalidState{};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,12 +5,18 @@
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
Result KWritableEvent::Signal() {
|
||||
return this->client->Signal();
|
||||
KWritableEvent::~KWritableEvent()
|
||||
{
|
||||
}
|
||||
|
||||
Result KWritableEvent::Clear() {
|
||||
return this->client->Clear();
|
||||
Result KWritableEvent::Signal()
|
||||
{
|
||||
return client->Signal();
|
||||
}
|
||||
|
||||
Result KWritableEvent::Clear()
|
||||
{
|
||||
return client->Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
26
mesosphere/source/threading/KEvent.cpp
Normal file
26
mesosphere/source/threading/KEvent.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <mesosphere/processes/KEvent.hpp>
|
||||
#include <mesosphere/core/KCoreContext.hpp>
|
||||
#include <mesosphere/processes/KProcess.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
KEvent::~KEvent()
|
||||
{
|
||||
}
|
||||
|
||||
bool KEvent::IsAlive() const
|
||||
{
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
Result KEvent::Initialize()
|
||||
{
|
||||
SetClientServerParent();
|
||||
SetResourceOwner(KCoreContext::GetCurrentInstance().GetCurrentProcess());
|
||||
isInitialized = true;
|
||||
|
||||
return ResultSuccess{};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ void KMutex::lock_slow_path(KThread &owner, KThread &requester)
|
||||
|
||||
void KMutex::unlock_slow_path(KThread &owner)
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
size_t count;
|
||||
KThread *newOwner = owner.RelinquishMutex(&count, (uiptr)this);
|
||||
native_handle_type newTag;
|
||||
|
||||
@@ -46,7 +46,7 @@ void KThread::RescheduleIfStatusEquals(SchedulingStatus expectedStatus, Scheduli
|
||||
|
||||
void KThread::AddForcePauseReason(KThread::ForcePauseReason reason)
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
|
||||
if (!IsDying()) {
|
||||
AddForcePauseReasonToField(reason);
|
||||
@@ -58,7 +58,7 @@ void KThread::AddForcePauseReason(KThread::ForcePauseReason reason)
|
||||
|
||||
void KThread::RemoveForcePauseReason(KThread::ForcePauseReason reason)
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
|
||||
if (!IsDying()) {
|
||||
RemoveForcePauseReasonToField(reason);
|
||||
@@ -104,7 +104,7 @@ void KThread::ResumeAllFromKernelSync(KThread::WaitList &waitList)
|
||||
|
||||
void KThread::CancelKernelSync()
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
if (GetSchedulingStatus() == SchedulingStatus::Paused) {
|
||||
// Note: transparent to force-pause
|
||||
if (currentWaitList != nullptr) {
|
||||
@@ -136,7 +136,7 @@ Result KThread::WaitSynchronizationImpl(int &outId, KSynchronizationObject **syn
|
||||
|
||||
outId = -1;
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
|
||||
// Try to find an already signaled object.
|
||||
if (numSyncObjs >= 1) {
|
||||
@@ -178,7 +178,7 @@ Result KThread::WaitSynchronizationImpl(int &outId, KSynchronizationObject **syn
|
||||
// Now waiting...
|
||||
|
||||
{
|
||||
KScopedCriticalSection critical_section;
|
||||
KScopedCriticalSection criticalSection;
|
||||
|
||||
isWaitingSync = false;
|
||||
if (timeoutTime > KSystemClock::time_point{}) {
|
||||
|
||||
Reference in New Issue
Block a user