Commit graph

6 commits

Author SHA1 Message Date
kleines Filmröllchen
3d6e08156d LibThreading: Introduce MutexProtected generic synchronization primitive
MutexProtected mirrors the identically-named Kernel primitive and can be
used to synchronize access to any object that might not be thread safe
on its own. Synchronization is done with a simple mutex, so access to a
MutexProtected object is potentially blocking.

Mutex now has an internal nesting variable which is there to harden it
against lock-unlock ordering issues (e.g. double unlocking).
2022-01-23 15:21:10 +01:00
Ben Wiederhake
d9a0d2182d LibThreading: Add missing headers to Mutex.h 2021-10-06 23:52:40 +01:00
Brian Gianforcaro
744de5ec69 LibThreading: Use default instead of an empty constructor/destructor
Default implementations allow for more optimizations.
See: https://pvs-studio.com/en/docs/warnings/v832/
2021-09-16 17:17:13 +02:00
Brian Gianforcaro
bff33c67ab LibThreading: Neither Mutex or MutexLocker should be movable / copyable 2021-09-16 17:17:13 +02:00
kleines Filmröllchen
c7104e7512 LibThreading: Add ConditionVariable wrapper
ConditionVariable is a thin wrapper over the pthread_cond_* APIs, just
as Mutex is a wrapper over pthread_mutex.

Because ConditionVariable might want to wait on a high-level Mutex, it
needs to be friends with it.
2021-09-12 23:38:57 +02:00
Andreas Kling
b8a204c5b9 LibThreading: Rename Lock => Mutex 2021-07-09 11:15:50 +02:00
Renamed from Userland/Libraries/LibThreading/Lock.h (Browse further)