3
0
Fork 0
forked from suyu/suyu

hle: kernel: service_thread: Add parameter for thread pool size.

This commit is contained in:
bunnei 2020-12-10 16:03:35 -08:00
parent 19a8f03ad5
commit 8bc3d66354
3 changed files with 7 additions and 7 deletions

View file

@ -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));
}

View file

@ -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;

View file

@ -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);