mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-11 08:39:28 +01:00
Add hacky Wait method to prioritizedworkqueue
This commit is contained in:
1 parent
e497942827
commit
feb521fd41
2 files changed
+19
-1
No files matched your search
@@ -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