ladybird/Userland
kleines Filmröllchen 2fcb713037 LibThreading: Overhaul thread behavior with ThreadState
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).
2022-12-11 19:07:20 -07:00
..
Applets Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Applications Help: Link to LibLocale 2022-12-11 13:59:41 -07:00
BuggieBox Userland: Add the BuggieBox program 2022-11-26 12:41:47 -07:00
Demos LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
DevTools LibX86: Only pass ProcessorMode to Instruction constructor 2022-12-11 22:06:30 +01:00
DynamicLoader AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Games MasterWord: Display the last word in a different color for short input 2022-12-11 22:10:37 +01:00
Libraries LibThreading: Overhaul thread behavior with ThreadState 2022-12-11 19:07:20 -07:00
Services WindowServer: Remove unused bools in Menu::draw() 2022-12-11 20:25:58 +01:00
Shell Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Utilities Help+man+LibManual: Move argument handling to LibManual 2022-12-11 16:05:23 +00:00
CMakeLists.txt Userland: Add the BuggieBox program 2022-11-26 12:41:47 -07:00