kernel: Tweak some timer code
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dfebdce689
commit
e28e1c682c
@ -13,7 +13,10 @@ Result<u64> sys_alarm(Registers*, SyscallArgs args)
|
|||||||
|
|
||||||
u64 ticks_left = current->timer ? current->timer->ticks_left() : 0;
|
u64 ticks_left = current->timer ? current->timer->ticks_left() : 0;
|
||||||
|
|
||||||
if (current->timer) Scheduler::remove_from_timer_queue(current->timer);
|
if (current->timer)
|
||||||
|
{
|
||||||
|
if (current->timer->delta_ticks > 0) Scheduler::remove_from_timer_queue(current->timer);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
current->timer = TRY(make<Scheduler::Timer>());
|
current->timer = TRY(make<Scheduler::Timer>());
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ namespace Scheduler
|
|||||||
u64 Timer::ticks_left()
|
u64 Timer::ticks_left()
|
||||||
{
|
{
|
||||||
u64 total = 0;
|
u64 total = 0;
|
||||||
|
if (delta_ticks == 0) return 0;
|
||||||
for (auto* t : g_timer_queue)
|
for (auto* t : g_timer_queue)
|
||||||
{
|
{
|
||||||
total += t->delta_ticks;
|
total += t->delta_ticks;
|
||||||
|
Loading…
Reference in New Issue
Block a user