mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 14:01:25 +12:00
Rename and move g_tls_current_cpu_thread inside cpu_thread
Don't declare extern inside get_current_cpu_thread(). Possible workaround for gcc-11.
This commit is contained in:
parent
1d7fbd6a9a
commit
2decf1ecda
2 changed files with 10 additions and 7 deletions
|
@ -252,7 +252,7 @@ struct cpu_prof
|
|||
|
||||
using cpu_profiler = named_thread<cpu_prof>;
|
||||
|
||||
thread_local cpu_thread* g_tls_current_cpu_thread = nullptr;
|
||||
thread_local DECLARE(cpu_thread::g_tls_this_thread) = nullptr;
|
||||
|
||||
// Total number of CPU threads
|
||||
static atomic_t<u64, 64> s_cpu_counter{0};
|
||||
|
@ -403,7 +403,7 @@ namespace cpu_counter
|
|||
|
||||
void cpu_thread::operator()()
|
||||
{
|
||||
g_tls_current_cpu_thread = this;
|
||||
g_tls_this_thread = this;
|
||||
|
||||
if (g_cfg.core.thread_scheduler_enabled)
|
||||
{
|
||||
|
@ -535,7 +535,7 @@ void cpu_thread::operator()()
|
|||
|
||||
s_cpu_counter--;
|
||||
|
||||
g_tls_current_cpu_thread = nullptr;
|
||||
g_tls_this_thread = nullptr;
|
||||
|
||||
g_threads_deleted++;
|
||||
|
||||
|
@ -1119,7 +1119,7 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept
|
|||
|
||||
void cpu_thread::stop_all() noexcept
|
||||
{
|
||||
if (g_tls_current_cpu_thread)
|
||||
if (g_tls_this_thread)
|
||||
{
|
||||
// Report unsupported but unnecessary case
|
||||
sys_log.fatal("cpu_thread::stop_all() has been called from a CPU thread.");
|
||||
|
|
|
@ -243,13 +243,16 @@ public:
|
|||
|
||||
// Send signal to the profiler(s) to flush results
|
||||
static void flush_profilers() noexcept;
|
||||
|
||||
private:
|
||||
static thread_local cpu_thread* g_tls_this_thread;
|
||||
|
||||
friend cpu_thread* get_current_cpu_thread() noexcept;
|
||||
};
|
||||
|
||||
inline cpu_thread* get_current_cpu_thread() noexcept
|
||||
{
|
||||
extern thread_local cpu_thread* g_tls_current_cpu_thread;
|
||||
|
||||
return g_tls_current_cpu_thread;
|
||||
return cpu_thread::g_tls_this_thread;
|
||||
}
|
||||
|
||||
class ppu_thread;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue