diff options
| author | 2017-01-04 12:48:13 -0500 | |
|---|---|---|
| committer | 2017-01-05 09:40:18 -0500 | |
| commit | dda4ec93bea089e3286e9a965378d9411f480acd (patch) | |
| tree | 29b3fcb87e02fc92e514e28877b588f09264c026 /src/core/hle/kernel/thread.cpp | |
| parent | Kernel: Remove a thread from all of its waiting objects' waiting_threads list... (diff) | |
| download | yuzu-dda4ec93bea089e3286e9a965378d9411f480acd.tar.gz yuzu-dda4ec93bea089e3286e9a965378d9411f480acd.tar.xz yuzu-dda4ec93bea089e3286e9a965378d9411f480acd.zip | |
Kernel: Add some asserts to enforce the invariants in the scheduler.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 568cef5b9..9109bd10b 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -200,8 +200,8 @@ static void SwitchContext(Thread* new_thread) { | |||
| 200 | 200 | ||
| 201 | // Load context of new thread | 201 | // Load context of new thread |
| 202 | if (new_thread) { | 202 | if (new_thread) { |
| 203 | DEBUG_ASSERT_MSG(new_thread->status == THREADSTATUS_READY, | 203 | ASSERT_MSG(new_thread->status == THREADSTATUS_READY, |
| 204 | "Thread must be ready to become running."); | 204 | "Thread must be ready to become running."); |
| 205 | 205 | ||
| 206 | // Cancel any outstanding wakeup events for this thread | 206 | // Cancel any outstanding wakeup events for this thread |
| 207 | CoreTiming::UnscheduleEvent(ThreadWakeupEventType, new_thread->callback_handle); | 207 | CoreTiming::UnscheduleEvent(ThreadWakeupEventType, new_thread->callback_handle); |
| @@ -307,6 +307,8 @@ void Thread::WakeAfterDelay(s64 nanoseconds) { | |||
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | void Thread::ResumeFromWait() { | 309 | void Thread::ResumeFromWait() { |
| 310 | ASSERT_MSG(wait_objects.empty(), "Thread is waking up while waiting for objects"); | ||
| 311 | |||
| 310 | switch (status) { | 312 | switch (status) { |
| 311 | case THREADSTATUS_WAIT_SYNCH_ALL: | 313 | case THREADSTATUS_WAIT_SYNCH_ALL: |
| 312 | case THREADSTATUS_WAIT_SYNCH_ANY: | 314 | case THREADSTATUS_WAIT_SYNCH_ANY: |
| @@ -580,6 +582,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) { | |||
| 580 | } | 582 | } |
| 581 | 583 | ||
| 582 | s32 Thread::GetWaitObjectIndex(WaitObject* object) const { | 584 | s32 Thread::GetWaitObjectIndex(WaitObject* object) const { |
| 585 | ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); | ||
| 583 | auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); | 586 | auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); |
| 584 | return std::distance(match, wait_objects.rend()) - 1; | 587 | return std::distance(match, wait_objects.rend()) - 1; |
| 585 | } | 588 | } |