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->name = std::move(name);
session->parent = std::move(parent); 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)); return MakeResult(std::move(session));
} }

View file

@ -22,7 +22,7 @@ namespace Kernel {
class ServiceThread::Impl final { class ServiceThread::Impl final {
public: public:
explicit Impl(KernelCore& kernel); explicit Impl(KernelCore& kernel, std::size_t num_threads);
~Impl(); ~Impl();
void QueueSyncRequest(ServerSession& session, std::shared_ptr<HLERequestContext>&& context); void QueueSyncRequest(ServerSession& session, std::shared_ptr<HLERequestContext>&& context);
@ -35,9 +35,8 @@ private:
bool stop{}; bool stop{};
}; };
ServiceThread::Impl::Impl(KernelCore& kernel) { ServiceThread::Impl::Impl(KernelCore& kernel, std::size_t num_threads) {
constexpr std::size_t SizeOfPool{1}; for (std::size_t i = 0; i < num_threads; ++i)
for (std::size_t i = 0; i < SizeOfPool; ++i)
threads.emplace_back([&] { threads.emplace_back([&] {
// Wait for first request before trying to acquire a render context // 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; ServiceThread::~ServiceThread() = default;

View file

@ -14,7 +14,7 @@ class ServerSession;
class ServiceThread final { class ServiceThread final {
public: public:
explicit ServiceThread(KernelCore& kernel); explicit ServiceThread(KernelCore& kernel, std::size_t num_threads);
~ServiceThread(); ~ServiceThread();
void QueueSyncRequest(ServerSession& session, std::shared_ptr<HLERequestContext>&& context); void QueueSyncRequest(ServerSession& session, std::shared_ptr<HLERequestContext>&& context);