There are now two thread lists, one for runnable threads and one for non-
runnable threads. Thread::set_state() is responsible for moving threads
between the lists.
Each thread also has a back-pointer to the list it's currently in.
select essentially has 3 modes (which is presumably why we're finding it
so hard to get this right in a reliable way :)).
1. NULL timeout -- no timeout on blocking
2. non-NULL timeout that is not zero'd -- timeout on blocking
3. non-NULL but zero timeout -- no blocking at all (immediate poll)
For cases 1 and 2, we want to block the thread. We have a timeout set
only for case 2, though.
Case 3 should not block the thread, and does not have a timeout set.
The scheduler expects m_select_timeout to act as a deadline. That is, it
should contain the time that a task should wake at -- but we were
directly copying the time from userspace, which meant that it always
returned virtually immediately.
At the same time, fix CEventLoop to not rely on the broken select behavior
by subtracting the current time from the time of the nearest timer.
Fullscreen windows are rendered alone and above everything else when they
are active, and as part of the regular window stack order when something
else is active.
Currently windows cannot be made fullscreen after-the-fact, but must have
the fullscreen flag included in their CreateWindow message.
It should not possible to interact with the menu, taskbar or window frame
while the active window is fullscreened. :^)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:
-DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
Based on the description I read, this syscall doesn't seem completely
reasonable, but let's at least return a number that is likely to change
between invocations in case somebody depends on that happening.
Might be an idea to add a minimum size constrain in window server
instead, since it knows the exact dimensions? But this is a simple fix
that seems to do the job.
It makes sense to keep this consistent between applications, and the
purpose of the string is not immediately obvious from an API perspective.
If we need to make it configurable later, that can come from a setter.
Also introduce more seek modes on CIODevice, and an out param to find
the current position inside the file -- this means less syscalls (and
less potential races) than requesting it through a separate pos()
accessor or something.
These functions were doing exactly the same thing for range allocation, so
share that code in an allocate_range() helper.
Region allocation will now also fail if range allocation fails, which means
that mmap() can actually fail without falling apart. Exciting times!