|
|
|
@ -185,17 +185,6 @@ struct KernelCore::Impl {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CloseServices() {
|
|
|
|
|
// Close all open server sessions and ports.
|
|
|
|
|
std::unordered_set<KAutoObject*> server_objects_;
|
|
|
|
|
{
|
|
|
|
|
std::scoped_lock lk(server_objects_lock);
|
|
|
|
|
server_objects_ = server_objects;
|
|
|
|
|
server_objects.clear();
|
|
|
|
|
}
|
|
|
|
|
for (auto* server_object : server_objects_) {
|
|
|
|
|
server_object->Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ensures all service threads gracefully shutdown.
|
|
|
|
|
ClearServiceThreads();
|
|
|
|
|
}
|
|
|
|
@ -699,9 +688,7 @@ struct KernelCore::Impl {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KClientPort* port = &search->second(system.ServiceManager(), system);
|
|
|
|
|
RegisterServerObject(&port->GetParent()->GetServerPort());
|
|
|
|
|
return port;
|
|
|
|
|
return &search->second(system.ServiceManager(), system);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RegisterNamedServiceHandler(std::string name, KServerPort* server_port) {
|
|
|
|
@ -713,16 +700,6 @@ struct KernelCore::Impl {
|
|
|
|
|
search->second(system.ServiceManager(), server_port);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RegisterServerObject(KAutoObject* server_object) {
|
|
|
|
|
std::scoped_lock lk(server_objects_lock);
|
|
|
|
|
server_objects.insert(server_object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UnregisterServerObject(KAutoObject* server_object) {
|
|
|
|
|
std::scoped_lock lk(server_objects_lock);
|
|
|
|
|
server_objects.erase(server_object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel,
|
|
|
|
|
const std::string& name) {
|
|
|
|
|
auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, name);
|
|
|
|
@ -755,7 +732,6 @@ struct KernelCore::Impl {
|
|
|
|
|
service_thread_barrier.Sync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::mutex server_objects_lock;
|
|
|
|
|
std::mutex registered_objects_lock;
|
|
|
|
|
std::mutex registered_in_use_objects_lock;
|
|
|
|
|
|
|
|
|
@ -786,7 +762,6 @@ struct KernelCore::Impl {
|
|
|
|
|
std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory;
|
|
|
|
|
std::unordered_map<std::string, ServiceInterfaceHandlerFn> service_interface_handlers;
|
|
|
|
|
NamedPortTable named_ports;
|
|
|
|
|
std::unordered_set<KAutoObject*> server_objects;
|
|
|
|
|
std::unordered_set<KAutoObject*> registered_objects;
|
|
|
|
|
std::unordered_set<KAutoObject*> registered_in_use_objects;
|
|
|
|
|
|
|
|
|
@ -1005,14 +980,6 @@ void KernelCore::RegisterNamedServiceHandler(std::string name, KServerPort* serv
|
|
|
|
|
impl->RegisterNamedServiceHandler(std::move(name), server_port);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KernelCore::RegisterServerObject(KAutoObject* server_object) {
|
|
|
|
|
impl->RegisterServerObject(server_object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KernelCore::UnregisterServerObject(KAutoObject* server_object) {
|
|
|
|
|
impl->UnregisterServerObject(server_object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KernelCore::RegisterKernelObject(KAutoObject* object) {
|
|
|
|
|
std::scoped_lock lk{impl->registered_objects_lock};
|
|
|
|
|
impl->registered_objects.insert(object);
|
|
|
|
|