mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-06 04:35:29 +02:00
Add hacky Wait method to prioritizedworkqueue
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "base/functional.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "thread/thread.h"
|
||||
#include "thread/prioritizedworkqueue.h"
|
||||
|
||||
@@ -66,6 +67,20 @@ PrioritizedWorkQueueItem *PrioritizedWorkQueue::Pop() {
|
||||
}
|
||||
}
|
||||
|
||||
void PrioritizedWorkQueue::Wait(PrioritizedWorkQueueItem *item) {
|
||||
while (true) {
|
||||
bool stillThere = false;
|
||||
lock_guard guard(mutex_);
|
||||
for (int i = 0; i < queue_.empty(); i++) {
|
||||
if (queue_[i] == item)
|
||||
stillThere = true;
|
||||
}
|
||||
if (!stillThere)
|
||||
break;
|
||||
sleep_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This feels ugly. Revisit later.
|
||||
|
||||
static std::thread *workThread;
|
||||
|
||||
Reference in New Issue
Block a user