ladybird/Libraries/LibThreading
R-Goc b7796b2f7d LibThreading: Add Once.h
Once.h provides a way to run a function once without relying on system
libraries at the call site. It also allows use of any function as long
as it satisfies the VoidFunction concept. For similarity with the STL I
would have preferred it to be in AK, but it needs a mutex to work so
that would cause a circular dependency.
With some templates and an optional it could be modified to return non
void types, but since that isn't an existing pattern in the codebase
that could be implemented in a follow-up.
Performance wise compared to pthread_once it should be very similar
in the already initialized case as both use an atomic. On the first call
this might be slightly slower since we use a mutex while pthread may be
doing something fancier with a futex or similar, but it shouldn't
matter.
2026-05-08 18:58:35 -05:00
..
BackgroundAction.cpp Everywhere: Move the thread name parameter for Thread constructors 2026-01-26 15:51:46 -06:00
BackgroundAction.h LibThreading: Simplify BackgroundAction callback invocation 2026-03-02 17:06:39 -06:00
CMakeLists.txt Meta: Move most dependency checks to check_for_dependencies.cmake 2026-04-20 16:41:29 -06:00
ConditionVariable.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Forward.h LibThreading: Remove WorkerThread 2026-01-26 15:51:46 -06:00
Mutex.h LibThreading: Clean up pthread mutex attributes and mutex itself 2025-02-20 15:04:50 -07:00
MutexProtected.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Once.h LibThreading: Add Once.h 2026-05-08 18:58:35 -05:00
RWLock.h LibThreading: Fix data race in RWLock::unlock() 2026-03-07 13:09:50 +01:00
RWLockProtected.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Thread.cpp LibThreading: Allow configuring thread stack size 2026-03-06 13:06:05 +01:00
Thread.h LibThreading: Allow configuring thread stack size 2026-03-06 13:06:05 +01:00
ThreadPool.cpp LibThreading: Add ThreadPool class 2026-03-06 13:06:05 +01:00
ThreadPool.h LibThreading: Add ThreadPool class 2026-03-06 13:06:05 +01:00