Rework CoreTiming

This commit is contained in:
Kelebek1 2022-07-10 06:59:40 +01:00
parent c765d5be0b
commit 240650f6a6
13 changed files with 154 additions and 82 deletions

View file

@ -234,17 +234,19 @@ struct KernelCore::Impl {
void InitializePreemption(KernelCore& kernel) {
preemption_event = Core::Timing::CreateEvent(
"PreemptionCallback", [this, &kernel](std::uintptr_t, std::chrono::nanoseconds) {
"PreemptionCallback",
[this, &kernel](std::uintptr_t, s64 time,
std::chrono::nanoseconds) -> std::optional<std::chrono::nanoseconds> {
{
KScopedSchedulerLock lock(kernel);
global_scheduler_context->PreemptThreads();
}
const auto time_interval = std::chrono::nanoseconds{std::chrono::milliseconds(10)};
system.CoreTiming().ScheduleEvent(time_interval, preemption_event);
return std::nullopt;
});
const auto time_interval = std::chrono::nanoseconds{std::chrono::milliseconds(10)};
system.CoreTiming().ScheduleEvent(time_interval, preemption_event);
system.CoreTiming().ScheduleLoopingEvent(std::chrono::nanoseconds(0), time_interval,
preemption_event);
}
void InitializeShutdownThreads() {