mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Untested libretro fixes, misc
This commit is contained in:
parent
09ec15e78b
commit
2d6a73792b
@ -46,6 +46,11 @@ ThreadManager::ThreadManager() : global_(new GlobalThreadContext()) {
|
||||
}
|
||||
|
||||
ThreadManager::~ThreadManager() {
|
||||
delete global_;
|
||||
global_ = nullptr;;
|
||||
}
|
||||
|
||||
void ThreadManager::Teardown() {
|
||||
for (size_t i = 0; i < global_->threads_.size(); i++) {
|
||||
global_->threads_[i]->cancelled = true;
|
||||
global_->threads_[i]->cond.notify_one();
|
||||
@ -55,7 +60,6 @@ ThreadManager::~ThreadManager() {
|
||||
delete global_->threads_[i];
|
||||
}
|
||||
global_->threads_.clear();
|
||||
delete global_;
|
||||
}
|
||||
|
||||
static void WorkerThreadFunc(GlobalThreadContext *global, ThreadContext *thread) {
|
||||
@ -95,6 +99,10 @@ static void WorkerThreadFunc(GlobalThreadContext *global, ThreadContext *thread)
|
||||
}
|
||||
|
||||
void ThreadManager::Init(int numRealCores, int numLogicalCores) {
|
||||
if (!global_->threads_.empty()) {
|
||||
Teardown();
|
||||
}
|
||||
|
||||
numComputeThreads_ = std::min(numRealCores, MAX_CORES_TO_USE);
|
||||
int numThreads = numComputeThreads_ + EXTRA_THREADS;
|
||||
numThreads_ = numThreads;
|
||||
|
@ -58,7 +58,9 @@ public:
|
||||
int GetNumLooperThreads() const;
|
||||
|
||||
private:
|
||||
GlobalThreadContext *global_;
|
||||
void Teardown();
|
||||
|
||||
GlobalThreadContext *global_ = nullptr;
|
||||
|
||||
int numThreads_ = 0;
|
||||
int numComputeThreads_ = 0;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/System/Display.h"
|
||||
@ -17,6 +18,7 @@
|
||||
#include "Common/ConsoleListener.h"
|
||||
#include "Common/Input/InputState.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Common/Thread/ThreadManager.h"
|
||||
#include "Common/File/VFS/VFS.h"
|
||||
#include "Common/File/VFS/AssetReader.h"
|
||||
|
||||
@ -400,6 +402,8 @@ void retro_init(void)
|
||||
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
g_threadManager.Init(cpu_info.num_cores, cpu_info.logical_cpu_count);
|
||||
|
||||
host = new LibretroHost;
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
||||
|
Loading…
Reference in New Issue
Block a user