1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00
ladybird/Userland/Libraries
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
..
LibArchive AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibAudio AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibC Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibCards Meta+Userland: Pass Gfx::IntPoint by value 2022-12-07 11:48:27 +01:00
LibChess Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibCodeComprehension Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibCompress LibCompress: Port GzipDecompressor to Core::Stream 2022-12-10 12:05:55 +00:00
LibConfig AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibCore LibCore: Add a standard path for runtime communication files 2022-12-11 10:08:17 -05:00
LibCoredump LibCompress: Port GzipDecompressor to Core::Stream 2022-12-10 12:05:55 +00:00
LibCpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibCrypt AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibCrypto Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
LibDebug Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibDesktop Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibDeviceTree AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibDiff Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibDNS Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibDSP Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
LibEDID Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
LibELF Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibFileSystemAccessClient AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibGemini Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibGfx LibGfx: Allow creating Bitmaps from ReadonlyBytes objects 2022-12-10 10:49:03 +01:00
LibGL LibGL: Generate GL_OUT_OF_MEMORY error in glBufferData when OOM 2022-12-07 11:46:37 +01:00
LibGPU Meta+Userland: Pass Gfx::IntSize by value 2022-12-07 11:48:27 +01:00
LibGUI LibGUI: Add shortcut for inserting new line 2022-12-11 19:47:42 +00:00
LibHTTP LibCompress: Port GzipDecompressor to Core::Stream 2022-12-10 12:05:55 +00:00
LibIDL Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibImageDecoderClient Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
LibIMAP Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibIPC LibIPC: Add a hook to MultiServer to inform owners of new clients 2022-12-11 10:08:17 -05:00
LibJS LibJS: Rename same_value_non_{numeric => number}() and handle BigInts 2022-12-10 11:35:20 +00:00
LibKeyboard Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibLine Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibLocale Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibMain Everywhere: Explicitly link all binaries against the LibC target 2022-11-01 14:49:09 +00:00
LibManual Help+man+LibManual: Move argument handling to LibManual 2022-12-11 16:05:23 +00:00
LibMarkdown LibJS: Convert MarkupGenerator to the new String 2022-12-07 09:58:38 +00:00
LibPartition Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
LibPCIDB AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibPDF LibPDF: Add initial image display support 2022-12-10 10:49:03 +01:00
LibProtocol AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibRegex Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
LibSanitizer LibC: Properly implement stack protectors 2022-11-01 14:49:09 +00:00
LibSoftGPU Meta+Userland: Pass Gfx::IntSize by value 2022-12-07 11:48:27 +01:00
LibSQL LibSQL: Don't use the SQL socket file path as its descriptor 2022-12-11 19:05:07 -07:00
LibSymbolication Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibSyntax AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibSystem
LibTest Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibTextCodec Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibThreading LibThreading: Overhaul thread behavior with ThreadState 2022-12-11 19:07:20 -07:00
LibTimeZone AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibTLS Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibUnicode Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibUSBDB AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
LibVideo Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibVT Meta+Userland: Pass Gfx::IntSize by value 2022-12-07 11:48:27 +01:00
LibWasm Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibWeb LibWeb: Support calc() values in background-position 2022-12-11 22:09:24 +01:00
LibWebSocket Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
LibWebView Browser+LibWebView+WebContent: Do not domain match on cookie updates 2022-12-08 17:14:48 +01:00
LibX86 LibX86: Only pass ProcessorMode to Instruction constructor 2022-12-11 22:06:30 +01:00
LibXML Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
CMakeLists.txt Help+LibManual: Move non-UI-specific manual handling to LibManual 2022-12-11 16:05:23 +00:00