Commit graph

6 commits

Author SHA1 Message Date
Andrew Kaster
e16bdb4a3c LibThreading: Add a way to cancel and join the background thread
This allows processes using BackgroundAction to actually exit when all
their threads have exited.
2024-04-26 09:41:24 +02:00
Zaggy1024
81b0b232e1 LibThreading: Set BackgroundAction's thread name correctly
Previously, init() in BackgroundAction.cpp was calling
Core::Object::set_name, which does not affect the displayed thread name
which is displayed by the system monitor. This changes it to pass the
name to the thread constructor.
2022-10-31 00:02:13 +01:00
Andreas Kling
b8a204c5b9 LibThreading: Rename Lock => Mutex 2021-07-09 11:15:50 +02:00
Andreas Kling
fd155193e7 LibThreading: Use a condvar to signal the BackgroundAction thread
Now that pthread_cond_t works correctly thanks to Sergey, we can use
them to wake up the BackgroundAction worker thread instead of making
a Unix pipe. :^)
2021-07-07 18:02:43 +02:00
Andreas Kling
e8579ed24a LibThreading: Wake up the background worker thread when there's work
The worker thread used for BackgroundAction was going to sleep for
1 second at a time (when there was nothing to do.) This made using
background actions for anything interactive quite unresponsive since
you had to wait up to 1 second before it even started on your task.

We now use a simple Unix pipe to signal the worker thread that a new
work item is available.

This makes Assistant way more responsive when typing. :^)
2021-07-04 18:56:08 +02:00
Andreas Kling
b5d73c834f Userland: Rename LibThread => LibThreading
Also rename the "LibThread" namespace to "Threading"
2021-05-22 18:54:22 +02:00
Renamed from Userland/Libraries/LibThread/BackgroundAction.cpp (Browse further)