mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-24 04:15:42 +01:00
kernel/readable_event: Add member function for enforcing a strict reset contract
svcResetSignal relies on the event instance to have already been signaled before attempting to reset it. If this isn't the case, then an error code has to be returned.
This commit is contained in:
parent
e5dd4cb392
commit
a3aa7aaf0b
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "core/hle/kernel/errors.h"
|
||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/kernel/readable_event.h"
|
#include "core/hle/kernel/readable_event.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
#include "core/hle/kernel/writable_event.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
@ -34,6 +34,16 @@ void ReadableEvent::Clear() {
|
|||||||
signaled = false;
|
signaled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResultCode ReadableEvent::Reset() {
|
||||||
|
if (!signaled) {
|
||||||
|
return ERR_INVALID_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Clear();
|
||||||
|
|
||||||
|
return RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void ReadableEvent::WakeupAllWaitingThreads() {
|
void ReadableEvent::WakeupAllWaitingThreads() {
|
||||||
WaitObject::WakeupAllWaitingThreads();
|
WaitObject::WakeupAllWaitingThreads();
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/kernel/wait_object.h"
|
#include "core/hle/kernel/wait_object.h"
|
||||||
|
|
||||||
|
union ResultCode;
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
@ -39,8 +41,17 @@ public:
|
|||||||
|
|
||||||
void WakeupAllWaitingThreads() override;
|
void WakeupAllWaitingThreads() override;
|
||||||
|
|
||||||
|
/// Unconditionally clears the readable event's state.
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
|
/// Clears the readable event's state if and only if it
|
||||||
|
/// has already been signaled.
|
||||||
|
///
|
||||||
|
/// @pre The event must be in a signaled state. If this event
|
||||||
|
/// is in an unsignaled state and this function is called,
|
||||||
|
/// then ERR_INVALID_STATE will be returned.
|
||||||
|
ResultCode Reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ReadableEvent(KernelCore& kernel);
|
explicit ReadableEvent(KernelCore& kernel);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user