This replaces all state-related variables with a single ThreadState.
These are simplified over what the Kernel has, but capture all
userspace-available thread state.
Locking the state behind an atomic and using proper atomic operations
also gets rid of quite some deadlocks and race conditions that have
existed around m_tid and others beforehand.
In terms of behavior, this introduces the following changes:
- All thread state mishandling (e.g. joining a detached thread) crashes
the program. Mishandling thread state is a severe kind of concurrency
bug that might also be indeterministic, so letting it silently
disappear with the return value of pthread_ APIs is a bad idea. The
thread state can always be checked beforehand to ensure that no crash
happens.
- Destructing a still-running thread will crash in AK/Function, so the
Thread destructor issues its own warning for debugging purposes.
- Thread issues warnings before crashes in many places to aid
concurrency debugging (the most difficult kind of debugging).
- Joining dead but not detached threads is legal, as per POSIX APIs.
- The thread ID is never reset to 0 after the thread has been started
and subsequently been assigned a valid thread ID. The thread's exit
state is still obtainable.
- Detaching threads that are about to exit is considered a programming
bug and will often (not always, as we can't catch all execution
sequences involved in such a situation) crash the program on purpose.
If you want to detach a thread that will definitely exit on its own,
you have to prevent it from exiting before detach() was called (e.g.
with an "exit requested" flag).
Joining dead threads is allowed for two main reasons:
- Thread join behavior should not be racy when a thread is joined and
exiting at roughly the same time. This is common behavior when threads
are given a signal to end (meaning they are going to exit ASAP) and
then joined.
- POSIX requires that exited threads are joinable (at least, there is no
language in the specification forbidding it).
The behavior is still well-defined; e.g. it doesn't allow a dead
detached thread to be joined or a thread to be joined more than once.
This is just used to key the socket fd for system server takeover. On
macOS, this file path has a space in it, which trips up the parsing as
it splits on spaces. That parsing should be fixed (probably shouldn't
rely on spaces as a delimter), but for now, we can change the key to
avoid spaces.
Previously, the word was highlighted red in case it was not found in the
dictionary. That color was repurposed as a general "invalid input" color
to nudge the player that something was wrong with the last input.
Accordingly, the field m_last_word_not_in_dictionary was renamed to
m_last_word_invalid
In the "inspiration" for this game, messages are displayed on top of the
game area in case an invalid guess is inputted. After a few seconds,
they disappear. In a similar fashion, a statusbar is created on the game
window and similar messages are outputted there.
Even if block has all children inline there need to be a check
if it creates BFC because otherwise IFC will be looking in
wrong parent BFC to calculate space used by floats.
We previously passed both OperandSize and AddressSize to the
constructor.
Both values were only ever 32-bit at construction.
We used AddressSize::Size64 to signify Long mode which was needlessly
complicated.
As the existing near-by comment says, the default size of displacements
& immediates is 32 bits even in Long mode.
This makes `disasm` work on our binaries in x86-64 builds.
This adds shortcut for inserting a new empty indented line
above/below current cursor position.
- <Ctrl-Return> for inserting line below.
- <Ctrl-Shift-Return> for inserting line above.
Added in d522a6f and 1e604b7, their purpose snuffed out in 11bb88f
like the faint pulse of a pleading candle, two lives of short excess,
doomed to itemize their sins to no effect and for all eternity...
Note that Jakt only allows StringView creation from string literals, so
none of the invariants in the class are broken by this (if used only
from within Jakt).
This allows the user to transform the contents of the optional (if any
exists), without manually unwrapping and then rewrapping it.
This is needed by the Jakt runtime.
This is used in Jakt, and providing that value from Jakt's side is more
trouble than doing this.
Considering this class is bound to go away, a little
backwards-compatible API change is just fine.
This deduplicates argument handling logic from Help and man and makes it
more modular for future use cases. The argument handling works as
before: two arguments specify section and page (in this order), one
argument specifies either a page (the first section that it's found in
is used) or a path to a manpage markdown file.