Commit graph

22 commits

Author SHA1 Message Date
Jonathan Gamble
1e9f97a612 LibThreading: Run BackgroundAction error handlers on the origin loop
BEHAVIOR CHANGE: Don't call on_error if cancelled, just reject.
Don't reject promise from the background thread.
Prevent data race on cancelled flag.
2026-01-28 15:36:33 -06:00
Zaggy1024
e2635af2ed Everywhere: Move the thread name parameter for Thread constructors
The name parameter formats very poorly when a lambda is passed to
Thread, so let's instead put it first now that all Threads are named.
2026-01-26 15:51:46 -06:00
Zaggy1024
d0f53ddab6 LibThreading: Remove WorkerThread
This is unused.
2026-01-26 15:51:46 -06:00
Zaggy1024
5b0d6703da LibThreading: Make Thread names non-optional 2026-01-26 15:51:46 -06:00
Zaggy1024
2867f87592 Everywhere: Shorten existing thread names to 15 characters or less
pthread_setname_np only accepts 16-byte null-terminated strings, so any
names longer than this will need to be truncated.
2026-01-26 15:51:46 -06:00
Zaggy1024
3cb39baa44 LibThreading: Set system threads' names based on Thread::thread_name() 2026-01-26 15:51:46 -06:00
Zaggy1024
786ea6c8f2 LibThreading: Use WeakEventLoopReference in BackgroundAction
BackgroundAction already assumes the event loop is alive, now we can
assert that it is.
2025-12-09 16:12:40 -06:00
Zaggy1024
3742138cc3 LibCore+LibThreading: Always wake the event loop when deferred invoking 2025-12-09 16:12:40 -06:00
Zaggy1024
fceb73e65a LibThreading: Remove Weakable from Thread
Weakable is not thread-safe, so taking a strong reference from a
WeakPtr<Thread> may result in a use-after-free. We don't use this
functionality anywhere anyway, so remove it.
2025-09-22 17:28:21 -05:00
Zaggy1024
2aaf53bd2c Everywhere: Use a forward declaration for pointers to Threading::Thread 2025-09-22 17:28:21 -05:00
Zaggy1024
5383265b9c LibThreading: Forward-declare Thread in LibThreading/Forward.h
The class is ref-counted, so using forward declarations in a lot of
headers currently including Thread.h is an easy change.
2025-09-22 17:28:21 -05:00
Zaggy1024
55f334b473 LibThreading: Correct the authors in the copyright comment in Forward.h
I created this file a couple years ago, but had a copy/pasted copyright
comment from another file, without the authors being changed. It's now
corrected to attribute it to myself, as it should have been already.
2025-09-22 17:28:21 -05:00
ayeteadoe
25f5936dee CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
Daniel Bertalan
a2167f126d Everywhere: Fix trivial -Wunnecessary-virtual-specifier instances
- `Threading::Thread` is not polymorphic, there is no need for a virtual
  destructor.
- `HTMLAnchorElement::has_download_preference` isn't overridden by
  anything.

This warning was introduced in llvm/llvm-project#131188.
2025-05-12 11:40:45 -06:00
Andrew Kaster
c19ecf33d9 LibThreading: Clean up pthread mutex attributes and mutex itself 2025-02-20 15:04:50 -07:00
stasoid
778947213b ImageDecoder: Port to Windows 2025-02-14 09:38:59 -07:00
Timothy Flynn
5f9ed343b3 LibThreading: Pass ownership of a BackgroundAction result to its caller
There is no need to create a copy of potentially expensive structures.
2025-02-10 16:05:43 +00:00
Timothy Flynn
f20aa82c27 LibThreading: Avert a reference cycle in BackgroundAction
When a BackgroundAction completes, it resolves a Promise (stored on the
BackgroundAction object) with a reference to itself. The Promise will
never unset this resolved value, thus it will hold a strong reference to
the BackgroundAction until it is destroyed. But because the Promise is
owned by the BackgroundAction itself, we have a reference cycle, and
neither object can be destroyed.

The only user of BackgroundAction is the ImageDecoder process. The
consequence was that the ImageDecoder process would never release any
image data for successfully decoded images.

To fix this, instead of storing the promise on the class itself, we can
just create it as a local variable and pass it around.
2025-02-10 16:05:43 +00:00
Tim Ledbetter
5d4aa15ada LibThreading: Make MutexLocker [[nodiscard]] 2025-01-10 13:21:36 +00:00
stasoid
15a96e841b Meta: Make pthread and mman available for all libraries on Windows
by default
2024-12-18 05:55:58 +01:00
stasoid
85da489f39 LibThreading: Build on Windows 2024-12-08 17:19:42 -07:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00