mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-27 06:21:02 +00:00
Remove g_thread_count
Unnecessary global which is bad to reason about. Possibly fix a but in SPRX loader.
This commit is contained in:
parent
49e96b39dd
commit
8e21f4d5d4
@ -1653,9 +1653,6 @@ const bool s_exception_handler_set = []() -> bool
|
||||
|
||||
#endif
|
||||
|
||||
// TODO
|
||||
atomic_t<u32> g_thread_count(0);
|
||||
|
||||
thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr;
|
||||
|
||||
DECLARE(thread_ctrl::g_native_core_layout) { native_core_arrangement::undefined };
|
||||
@ -1683,8 +1680,6 @@ void thread_base::initialize(bool(*wait_cb)(const void*))
|
||||
return thread_ctrl::g_tls_this_thread->m_name.get();
|
||||
};
|
||||
|
||||
++g_thread_count;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
struct THREADNAME_INFO
|
||||
{
|
||||
@ -1792,7 +1787,6 @@ void thread_base::finalize() noexcept
|
||||
{
|
||||
g_tls_log_prefix = []() -> std::string { return {}; };
|
||||
thread_ctrl::g_tls_this_thread = nullptr;
|
||||
--g_thread_count;
|
||||
}
|
||||
|
||||
void thread_ctrl::_wait_for(u64 usec, bool alert /* true */)
|
||||
|
@ -54,8 +54,6 @@ bool g_use_rtm;
|
||||
|
||||
std::string g_cfg_defaults;
|
||||
|
||||
extern atomic_t<u32> g_thread_count;
|
||||
|
||||
extern void ppu_load_exec(const ppu_exec_object&);
|
||||
extern void spu_load_exec(const spu_exec_object&);
|
||||
extern void ppu_initialize(const ppu_module&);
|
||||
@ -1148,6 +1146,8 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
||||
|
||||
g_progr = "Compiling PPU modules";
|
||||
|
||||
atomic_t<u32> worker_count = 0;
|
||||
|
||||
for (std::size_t i = 0; i < file_queue.size(); i++)
|
||||
{
|
||||
const auto& path = file_queue[i].first;
|
||||
@ -1169,16 +1169,19 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
||||
{
|
||||
if (auto prx = ppu_load_prx(obj, path))
|
||||
{
|
||||
while (g_thread_count >= max_threads + 2)
|
||||
worker_count++;
|
||||
|
||||
while (worker_count > max_threads)
|
||||
{
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
|
||||
thread_queue.emplace("Worker " + std::to_string(thread_queue.size()), [_prx = std::move(prx)]
|
||||
thread_queue.emplace("Worker " + std::to_string(thread_queue.size()), [_prx = std::move(prx), &worker_count]
|
||||
{
|
||||
ppu_initialize(*_prx);
|
||||
ppu_unload_prx(*_prx);
|
||||
g_progr_fdone++;
|
||||
worker_count--;
|
||||
});
|
||||
|
||||
continue;
|
||||
@ -1788,17 +1791,9 @@ void Emulator::Stop(bool restart)
|
||||
GetCallbacks().on_stop();
|
||||
|
||||
cpu_thread::stop_all();
|
||||
|
||||
while (g_thread_count)
|
||||
{
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
|
||||
LOG_NOTICE(GENERAL, "All threads stopped...");
|
||||
|
||||
g_fxo->reset();
|
||||
lv2_obj::cleanup();
|
||||
idm::clear();
|
||||
g_fxo->reset();
|
||||
|
||||
LOG_NOTICE(GENERAL, "Objects cleared...");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user