diff --git a/rpcs3/util/Thread.h b/rpcs3/util/Thread.h index 258bffcd3..3f2bc031a 100644 --- a/rpcs3/util/Thread.h +++ b/rpcs3/util/Thread.h @@ -771,10 +771,20 @@ public: { // Copy the context new (static_cast(m_threads + i)) Thread(std::string(name) + std::to_string(i + 1), static_cast(f)); + + if constexpr (requires { f(i); }) + { + m_threads[i](i); + } } // Move the context (if movable) new (static_cast(m_threads + m_count - 1)) Thread(std::string(name) + std::to_string(m_count), std::forward(f)); + + if constexpr (requires { f(m_count - 1); }) + { + m_threads[m_count - 1](m_count - 1); + } } // Constructor with a function performed before adding more threads