Merge pull request #466 from Subv/wake

Thread: Prevent waking a thread multiple times.
master
bunnei 2015-01-11 13:39:23 +07:00
commit 542b0b0057
1 changed files with 3 additions and 0 deletions

@ -263,6 +263,9 @@ void WakeThreadAfterDelay(Thread* thread, s64 nanoseconds) {
/// Resumes a thread from waiting by marking it as "ready" /// Resumes a thread from waiting by marking it as "ready"
void Thread::ResumeFromWait() { void Thread::ResumeFromWait() {
// Cancel any outstanding wakeup events
CoreTiming::UnscheduleEvent(ThreadWakeupEventType, GetHandle());
status &= ~THREADSTATUS_WAIT; status &= ~THREADSTATUS_WAIT;
wait_object = nullptr; wait_object = nullptr;
wait_type = WAITTYPE_NONE; wait_type = WAITTYPE_NONE;