mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
Implement event loop timers.
GObjects can now register a timer with the GEventLoop. This will eventually cause GTimerEvents to be dispatched to the GObject. This needed a few supporting changes in the kernel: - The PIT now ticks 1000 times/sec. - select() now supports an arbitrary timeout. - gettimeofday() now returns something in the tv_usec field. With these changes, the clock window in guitest2 finally ticks on its own.
This commit is contained in:
parent
9153666e72
commit
95c3442d59
Notes:
sideshowbarker
2024-07-19 15:54:21 +09:00
Author: https://github.com/awesomekling
Commit: 95c3442d59
10 changed files with 140 additions and 7 deletions
|
@ -60,12 +60,16 @@ void GObject::start_timer(int ms)
|
|||
dbgprintf("GObject{%p} already has a timer!\n", this);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
m_timer_id = GEventLoop::main().register_timer(*this, ms, true);
|
||||
}
|
||||
|
||||
void GObject::stop_timer()
|
||||
{
|
||||
if (!m_timer_id)
|
||||
return;
|
||||
bool success = GEventLoop::main().unregister_timer(m_timer_id);
|
||||
ASSERT(success);
|
||||
m_timer_id = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue