service_thread: remove explicit KProcess

This commit is contained in:
Liam
2022-11-10 16:14:03 -05:00
parent ea41c53ab1
commit b34d3d5882
2 changed files with 13 additions and 29 deletions

View File

@ -20,8 +20,12 @@ void KEvent::Initialize(KProcess* owner) {
m_readable_event.Initialize(this);
// Set our owner process.
m_owner = owner;
m_owner->Open();
// HACK: this should never be nullptr, but service threads don't have a
// proper parent process yet.
if (owner != nullptr) {
m_owner = owner;
m_owner->Open();
}
// Mark initialized.
m_initialized = true;
@ -50,8 +54,11 @@ Result KEvent::Clear() {
void KEvent::PostDestroy(uintptr_t arg) {
// Release the event count resource the owner process holds.
KProcess* owner = reinterpret_cast<KProcess*>(arg);
owner->GetResourceLimit()->Release(LimitableResource::EventCountMax, 1);
owner->Close();
if (owner != nullptr) {
owner->GetResourceLimit()->Release(LimitableResource::EventCountMax, 1);
owner->Close();
}
}
} // namespace Kernel