예제 #1
0
파일: thread.cpp 프로젝트: Aurorer/citra
 /**
  * Wait for kernel object to synchronize
  * @param wait Boolean wait set if current thread should wait as a result of sync operation
  * @return Result of operation, 0 on success, otherwise error code
  */
 Result WaitSynchronization(bool* wait) {
     if (status != THREADSTATUS_DORMANT) {
         Handle thread = GetCurrentThreadHandle();
         if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) {
             waiting_threads.push_back(thread);
         }
         WaitCurrentThread(WAITTYPE_THREADEND, this->GetHandle());
         *wait = true;
     }
     return 0;
 }
예제 #2
0
파일: semaphore.cpp 프로젝트: St4rk/citra
    ResultVal<bool> WaitSynchronization() override {
        bool wait = !IsAvailable();

        if (wait) {
            Kernel::WaitCurrentThread(WAITTYPE_SEMA, GetHandle());
            waiting_threads.push(GetCurrentThreadHandle());
        } else {
            --available_count;
        }

        return MakeResult<bool>(wait);
    }
예제 #3
0
파일: thread.cpp 프로젝트: Aurorer/citra
/// Prints the thread queue for debugging purposes
void DebugThreadQueue() {
    Thread* thread = GetCurrentThread();
    if (!thread) {
        return;
    }
    INFO_LOG(KERNEL, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle());
    for (u32 i = 0; i < g_thread_queue.size(); i++) {
        Handle handle = g_thread_queue[i];
        s32 priority = g_thread_ready_queue.contains(handle);
        if (priority != -1) {
            INFO_LOG(KERNEL, "0x%02X 0x%08X", priority, handle);
        }
    }
}
예제 #4
0
파일: event.cpp 프로젝트: eriknelson/citra
 /**
  * Wait for kernel object to synchronize
  * @param wait Boolean wait set if current thread should wait as a result of sync operation
  * @return Result of operation, 0 on success, otherwise error code
  */
 Result WaitSynchronization(bool* wait) override {
     *wait = locked;
     if (locked) {
         Handle thread = GetCurrentThreadHandle();
         if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) {
             waiting_threads.push_back(thread);
         }
         Kernel::WaitCurrentThread(WAITTYPE_EVENT, GetHandle());
     }
     if (reset_type != RESETTYPE_STICKY && !permanent_locked) {
         locked = true;
     }
     return 0;
 }