mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +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
10 changed files with 140 additions and 7 deletions
|
@ -1442,7 +1442,7 @@ int Process::sys$gettimeofday(timeval* tv)
|
|||
InterruptDisabler disabler;
|
||||
auto now = RTC::now();
|
||||
tv->tv_sec = now;
|
||||
tv->tv_usec = 0;
|
||||
tv->tv_usec = PIT::ticks_since_boot() % 1000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1976,8 +1976,12 @@ int Process::sys$select(const Syscall::SC_select_params* params)
|
|||
// FIXME: Implement exceptfds support.
|
||||
ASSERT(!exceptfds);
|
||||
|
||||
// FIXME: Implement timeout support.
|
||||
ASSERT(!timeout || (!timeout->tv_sec && !timeout->tv_usec));
|
||||
if (timeout) {
|
||||
m_select_timeout = *timeout;
|
||||
m_select_has_timeout = true;
|
||||
} else {
|
||||
m_select_has_timeout = false;
|
||||
}
|
||||
|
||||
if (nfds < 0)
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue