os: refactor/rewrite entire namespace.

This commit is contained in:
Michael Scire 2020-04-08 02:21:35 -07:00
parent 6193283f03
commit 065485b971
181 changed files with 5353 additions and 1929 deletions

View file

@ -144,14 +144,14 @@ namespace {
constexpr inline sm::ServiceName ContentManagerServiceName = sm::ServiceName::Encode("ncm");
alignas(os::ThreadStackAlignment) u8 g_content_manager_thread_stack[16_KB];
alignas(os::ThreadStackAlignment) u8 g_location_resolver_thread_stack[16_KB];
class ContentManagerServerManager : public sf::hipc::ServerManager<ContentManagerNumServers, ContentManagerServerOptions, ContentManagerMaxSessions> {
private:
static constexpr size_t ThreadStackSize = 0x4000;
static constexpr int ThreadPriority = 0x15;
using ServiceType = ncm::ContentManagerImpl;
private:
os::StaticThread<ThreadStackSize> thread;
os::ThreadType thread;
std::shared_ptr<ServiceType> ncm_manager;
private:
static void ThreadFunction(void *_this) {
@ -159,7 +159,7 @@ namespace {
}
public:
ContentManagerServerManager(ServiceType *m)
: thread(ThreadFunction, this, ThreadPriority), ncm_manager()
: ncm_manager()
{
/* ... */
}
@ -170,11 +170,13 @@ namespace {
}
ams::Result StartThreads() {
return this->thread.Start();
R_TRY(os::CreateThread(std::addressof(this->thread), ThreadFunction, this, g_content_manager_thread_stack, sizeof(g_content_manager_thread_stack), 21));
os::StartThread(std::addressof(this->thread));
return ResultSuccess();
}
void Wait() {
this->thread.Join();
os::WaitThread(std::addressof(this->thread));
}
};
@ -193,12 +195,9 @@ namespace {
class LocationResolverServerManager : public sf::hipc::ServerManager<LocationResolverNumServers, LocationResolverServerOptions, LocationResolverMaxSessions> {
private:
static constexpr size_t ThreadStackSize = 0x4000;
static constexpr int ThreadPriority = 0x15;
using ServiceType = lr::LocationResolverManagerImpl;
private:
os::StaticThread<ThreadStackSize> thread;
os::ThreadType thread;
std::shared_ptr<ServiceType> lr_manager;
private:
static void ThreadFunction(void *_this) {
@ -206,7 +205,7 @@ namespace {
}
public:
LocationResolverServerManager(ServiceType *m)
: thread(ThreadFunction, this, ThreadPriority), lr_manager(sf::ServiceObjectTraits<ServiceType>::SharedPointerHelper::GetEmptyDeleteSharedPointer(m))
: lr_manager(sf::ServiceObjectTraits<ServiceType>::SharedPointerHelper::GetEmptyDeleteSharedPointer(m))
{
/* ... */
}
@ -216,11 +215,13 @@ namespace {
}
ams::Result StartThreads() {
return this->thread.Start();
R_TRY(os::CreateThread(std::addressof(this->thread), ThreadFunction, this, g_location_resolver_thread_stack, sizeof(g_location_resolver_thread_stack), 21));
os::StartThread(std::addressof(this->thread));
return ResultSuccess();
}
void Wait() {
this->thread.Join();
os::WaitThread(std::addressof(this->thread));
}
};