thread: Release resource limit in Thread::Stop
This commit is contained in:
@@ -60,12 +60,7 @@ void Thread::Acquire(Thread* thread) {
|
|||||||
Thread::Thread(KernelSystem& kernel, u32 core_id)
|
Thread::Thread(KernelSystem& kernel, u32 core_id)
|
||||||
: WaitObject(kernel), core_id(core_id), thread_manager(kernel.GetThreadManager(core_id)) {}
|
: WaitObject(kernel), core_id(core_id), thread_manager(kernel.GetThreadManager(core_id)) {}
|
||||||
|
|
||||||
Thread::~Thread() {
|
Thread::~Thread() = default;
|
||||||
auto process = owner_process.lock();
|
|
||||||
if (process) {
|
|
||||||
process->resource_limit->Release(ResourceLimitType::Thread, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread* ThreadManager::GetCurrentThread() const {
|
Thread* ThreadManager::GetCurrentThread() const {
|
||||||
return current_thread.get();
|
return current_thread.get();
|
||||||
@@ -101,6 +96,7 @@ void Thread::Stop() {
|
|||||||
((tls_address - Memory::TLS_AREA_VADDR) % Memory::CITRA_PAGE_SIZE) / Memory::TLS_ENTRY_SIZE;
|
((tls_address - Memory::TLS_AREA_VADDR) % Memory::CITRA_PAGE_SIZE) / Memory::TLS_ENTRY_SIZE;
|
||||||
if (auto process = owner_process.lock()) {
|
if (auto process = owner_process.lock()) {
|
||||||
process->tls_slots[tls_page].reset(tls_slot);
|
process->tls_slots[tls_page].reset(tls_slot);
|
||||||
|
process->resource_limit->Release(ResourceLimitType::Thread, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -288,6 +288,9 @@ void PLG_LDR::GetPluginPath(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<PLG_LDR> GetService(Core::System& system) {
|
std::shared_ptr<PLG_LDR> GetService(Core::System& system) {
|
||||||
|
if (!system.IsPoweredOn()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
return system.ServiceManager().GetService<PLG_LDR>("plg:ldr");
|
return system.ServiceManager().GetService<PLG_LDR>("plg:ldr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user