mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
hle: kernel: service_thread: Add parameter for thread pool size.
This commit is contained in:
parent
19a8f03ad5
commit
8bc3d66354
|
@ -34,7 +34,7 @@ ResultVal<std::shared_ptr<ServerSession>> ServerSession::Create(KernelCore& kern
|
|||
|
||||
session->name = std::move(name);
|
||||
session->parent = std::move(parent);
|
||||
session->service_thread = std::make_unique<ServiceThread>(kernel);
|
||||
session->service_thread = std::make_unique<ServiceThread>(kernel, 1);
|
||||
|
||||
return MakeResult(std::move(session));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Kernel {
|
|||
|
||||
class ServiceThread::Impl final {
|
||||
public:
|
||||
explicit Impl(KernelCore& kernel);
|
||||
explicit Impl(KernelCore& kernel, std::size_t num_threads);
|
||||
~Impl();
|
||||
|
||||
void QueueSyncRequest(ServerSession& session, std::shared_ptr<HLERequestContext>&& context);
|
||||
|
@ -35,9 +35,8 @@ private:
|
|||
bool stop{};
|
||||
};
|
||||
|
||||
ServiceThread::Impl::Impl(KernelCore& kernel) {
|
||||
constexpr std::size_t SizeOfPool{1};
|
||||
for (std::size_t i = 0; i < SizeOfPool; ++i)
|
||||
ServiceThread::Impl::Impl(KernelCore& kernel, std::size_t num_threads) {
|
||||
for (std::size_t i = 0; i < num_threads; ++i)
|
||||
threads.emplace_back([&] {
|
||||
// Wait for first request before trying to acquire a render context
|
||||
{
|
||||
|
@ -88,7 +87,8 @@ ServiceThread::Impl::~Impl() {
|
|||
}
|
||||
}
|
||||
|
||||
ServiceThread::ServiceThread(KernelCore& kernel) : impl{std::make_unique<Impl>(kernel)} {}
|
||||
ServiceThread::ServiceThread(KernelCore& kernel, std::size_t num_threads)
|
||||
: impl{std::make_unique<Impl>(kernel, num_threads)} {}
|
||||
|
||||
ServiceThread::~ServiceThread() = default;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class ServerSession;
|
|||
|
||||
class ServiceThread final {
|
||||
public:
|
||||
explicit ServiceThread(KernelCore& kernel);
|
||||
explicit ServiceThread(KernelCore& kernel, std::size_t num_threads);
|
||||
~ServiceThread();
|
||||
|
||||
void QueueSyncRequest(ServerSession& session, std::shared_ptr<HLERequestContext>&& context);
|
||||
|
|
Loading…
Reference in a new issue