1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

Kernel: Expose timers via a TimerId type

The public consumers of the timer API shouldn't need to know
the how timer id's are tracked internally. Expose a typedef
instead to allow the internal implementation to be protected
from potential churn in the future.

It's also just good API design.
This commit is contained in:
Brian Gianforcaro 2020-04-26 12:59:27 -07:00 committed by Andreas Kling
parent 13c122b8b2
commit eeb5318c25
3 changed files with 10 additions and 8 deletions

View file

@ -893,7 +893,7 @@ Thread::BlockResult Thread::wait_on(WaitQueue& queue, timeval* timeout, Atomic<b
set_state(State::Queued);
queue.enqueue(*current);
u64 timer_id = 0;
TimerId timer_id {};
if (timeout) {
timer_id = TimerQueue::the().add_timer(*timeout, [&]() {
wake_from_queue();