mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #17128 from hrydgard/thread-manager-fix
ThreadManager priority bugfix
This commit is contained in:
commit
fcf895fe1c
3 changed files with 6 additions and 5 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "Common/Log.h"
|
||||
#include "StringUtils.h"
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
#include <android/log.h>
|
||||
|
@ -71,7 +72,7 @@ bool HandleAssert(const char *function, const char *file, int line, const char *
|
|||
if (!getenv("CI")) {
|
||||
int msgBoxStyle = MB_ICONINFORMATION | MB_YESNO;
|
||||
std::wstring wtext = ConvertUTF8ToWString(formatted) + L"\n\nTry to continue?";
|
||||
std::wstring wcaption = ConvertUTF8ToWString(caption);
|
||||
std::wstring wcaption = ConvertUTF8ToWString(std::string(caption) + " " + GetCurrentThreadName());
|
||||
OutputDebugString(wtext.c_str());
|
||||
if (IDYES != MessageBox(0, wtext.c_str(), wcaption.c_str(), msgBoxStyle)) {
|
||||
return false;
|
||||
|
|
|
@ -24,9 +24,7 @@ struct Mailbox {
|
|||
|
||||
T Wait() {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
while (!dataReceived_) {
|
||||
condvar_.wait(lock);
|
||||
}
|
||||
condvar_.wait(lock, [&] {return dataReceived_;});
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,12 +164,14 @@ static void WorkerThreadFunc(GlobalThreadContext *global, TaskThreadContext *thr
|
|||
|
||||
// We are processing one now, so mark that.
|
||||
thread->queue_size++;
|
||||
break;
|
||||
} else if (thread->queue_size != 0) {
|
||||
// Check the thread, as we prefer a HIGH thread task to a global NORMAL task.
|
||||
std::unique_lock<std::mutex> lock(thread->mutex);
|
||||
if (!thread->private_queue[p].empty()) {
|
||||
task = thread->private_queue[p].front();
|
||||
thread->private_queue[p].pop_front();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +200,9 @@ static void WorkerThreadFunc(GlobalThreadContext *global, TaskThreadContext *thr
|
|||
if (task) {
|
||||
task->Run();
|
||||
task->Release();
|
||||
|
||||
// Reduce the queue size once complete.
|
||||
thread->queue_size--;
|
||||
// _dbg_assert_(thread->queue_size == thread->private_queue[0].size() + thread->private_queue[1].size() + thread->private_queue[2].size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue