mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
Rework WindowServer to use select() in its main event loop.
The system can finally idle without burning CPU. :^) There are some issues with scheduling making the mouse cursor sloppy and unresponsive that need to be dealt with.
This commit is contained in:
parent
f7ca6d254d
commit
4fef895eda
Notes:
sideshowbarker
2024-07-19 16:01:27 +09:00
Author: https://github.com/awesomekling
Commit: 4fef895eda
15 changed files with 121 additions and 33 deletions
|
@ -1295,6 +1295,7 @@ int Process::sys$open(const char* path, int options)
|
|||
if (number_of_open_file_descriptors() >= m_max_open_file_descriptors)
|
||||
return -EMFILE;
|
||||
int error = -EWHYTHO;
|
||||
ASSERT(cwd_inode());
|
||||
auto descriptor = VFS::the().open(path, error, options, cwd_inode()->identifier());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
|
@ -1960,8 +1961,15 @@ int Process::sys$select(const Syscall::SC_select_params* params)
|
|||
transfer_fds(writefds, m_select_write_fds);
|
||||
transfer_fds(readfds, m_select_read_fds);
|
||||
|
||||
block(BlockedSelect);
|
||||
Scheduler::yield();
|
||||
#ifdef DEBUG_IO
|
||||
dbgprintf("%s<%u> selecting on (read:%u, write:%u)\n", name().characters(), pid(), m_select_read_fds.size(), m_select_write_fds.size());
|
||||
#endif
|
||||
|
||||
if (!m_wakeup_requested) {
|
||||
block(BlockedSelect);
|
||||
Scheduler::yield();
|
||||
}
|
||||
m_wakeup_requested = false;
|
||||
|
||||
int markedfds = 0;
|
||||
|
||||
|
@ -1989,3 +1997,11 @@ int Process::sys$select(const Syscall::SC_select_params* params)
|
|||
|
||||
return markedfds;
|
||||
}
|
||||
|
||||
Inode* Process::cwd_inode()
|
||||
{
|
||||
// FIXME: This is retarded factoring.
|
||||
if (!m_cwd)
|
||||
m_cwd = VFS::the().root_inode();
|
||||
return m_cwd.ptr();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue