mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-21 18:35:13 -04:00
kern: devirtualize KReadableEvent::Reset, KWorkerTask::DoWorkerTask
This commit is contained in:
parent
fd187f952e
commit
54dde406bc
12 changed files with 62 additions and 24 deletions
|
@ -432,7 +432,7 @@ namespace ams::kern {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
void KProcess::DoWorkerTask() {
|
||||
void KProcess::DoWorkerTaskImpl() {
|
||||
/* Terminate child threads. */
|
||||
TerminateChildren(this, nullptr);
|
||||
|
||||
|
|
|
@ -59,14 +59,6 @@ namespace ams::kern {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result KReadableEvent::Clear() {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
this->Reset();
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result KReadableEvent::Reset() {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ namespace ams::kern {
|
|||
this->Close();
|
||||
}
|
||||
|
||||
void KThread::DoWorkerTask() {
|
||||
void KThread::DoWorkerTaskImpl() {
|
||||
/* Finish the termination that was begun by Exit(). */
|
||||
this->FinishTermination();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,17 @@ namespace ams::kern {
|
|||
|
||||
}
|
||||
|
||||
void KWorkerTask::DoWorkerTask() {
|
||||
if (auto * const thread = this->DynamicCast<KThread *>(); thread != nullptr) {
|
||||
return thread->DoWorkerTaskImpl();
|
||||
} else {
|
||||
auto * const process = this->DynamicCast<KProcess *>();
|
||||
MESOSPHERE_ABORT_UNLESS(process != nullptr);
|
||||
|
||||
return process->DoWorkerTaskImpl();
|
||||
}
|
||||
}
|
||||
|
||||
void KWorkerTaskManager::Initialize(s32 priority) {
|
||||
/* Reserve a thread from the system limit. */
|
||||
MESOSPHERE_ABORT_UNLESS(Kernel::GetSystemResourceLimit().Reserve(ams::svc::LimitableResource_ThreadCountMax, 1));
|
||||
|
|
|
@ -48,7 +48,11 @@ namespace ams::kern::svc {
|
|||
{
|
||||
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(event_handle);
|
||||
if (readable_event.IsNotNull()) {
|
||||
return readable_event->Clear();
|
||||
if (auto * const interrupt_event = readable_event->DynamicCast<KInterruptEvent *>(); interrupt_event != nullptr) {
|
||||
return interrupt_event->Clear();
|
||||
} else {
|
||||
return readable_event->Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,11 @@ namespace ams::kern::svc {
|
|||
{
|
||||
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(handle);
|
||||
if (readable_event.IsNotNull()) {
|
||||
return readable_event->Reset();
|
||||
if (auto * const interrupt_event = readable_event->DynamicCast<KInterruptEvent *>(); interrupt_event != nullptr) {
|
||||
return interrupt_event->Reset();
|
||||
} else {
|
||||
return readable_event->Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue