mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-26 09:01:20 -08:00
WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup.
This commit is contained in:
parent
c22bac6398
commit
5e77e2e1de
@ -19,13 +19,20 @@ HandleTable g_handle_table;
|
|||||||
u64 g_program_id = 0;
|
u64 g_program_id = 0;
|
||||||
|
|
||||||
void WaitObject::AddWaitingThread(Thread* thread) {
|
void WaitObject::AddWaitingThread(Thread* thread) {
|
||||||
if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) {
|
auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread);
|
||||||
|
if (itr == waiting_threads.end())
|
||||||
waiting_threads.push_back(thread);
|
waiting_threads.push_back(thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaitObject::RemoveWaitingThread(Thread* thread) {
|
||||||
|
auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread);
|
||||||
|
if (itr != waiting_threads.end())
|
||||||
|
waiting_threads.erase(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread* WaitObject::ResumeNextThread() {
|
Thread* WaitObject::ResumeNextThread() {
|
||||||
if (waiting_threads.empty()) return nullptr;
|
if (waiting_threads.empty())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
auto next_thread = waiting_threads.front();
|
auto next_thread = waiting_threads.front();
|
||||||
|
|
||||||
|
@ -105,7 +105,13 @@ public:
|
|||||||
void AddWaitingThread(Thread* thread);
|
void AddWaitingThread(Thread* thread);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes the next thread waiting on this object
|
* Removes a thread from waiting on this object (e.g. if it was resumed already)
|
||||||
|
* @param thread Pointer to thread to remove
|
||||||
|
*/
|
||||||
|
void RemoveWaitingThread(Thread* thead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resumes (and removes) the next thread waiting on this object
|
||||||
* @return Pointer to the thread that was resumed, nullptr if no threads are waiting
|
* @return Pointer to the thread that was resumed, nullptr if no threads are waiting
|
||||||
*/
|
*/
|
||||||
Thread* ResumeNextThread();
|
Thread* ResumeNextThread();
|
||||||
|
Loading…
Reference in New Issue
Block a user