10 #include <condition_variable> 13 #include <libcamera/base/private.h> 15 #include <libcamera/base/thread_annotations.h> 23 class LIBCAMERA_TSA_CAPABILITY("mutex") Mutex final
26 void lock() LIBCAMERA_TSA_ACQUIRE()
31 void unlock() LIBCAMERA_TSA_RELEASE()
37 friend class MutexLocker;
42 class LIBCAMERA_TSA_SCOPED_CAPABILITY MutexLocker final
45 explicit MutexLocker(Mutex &mutex) LIBCAMERA_TSA_ACQUIRE(mutex)
50 MutexLocker(Mutex &mutex, std::defer_lock_t t) noexcept LIBCAMERA_TSA_EXCLUDES(mutex)
51 : lock_(mutex.mutex_, t)
55 ~MutexLocker() LIBCAMERA_TSA_RELEASE()
59 void lock() LIBCAMERA_TSA_ACQUIRE()
64 bool try_lock() LIBCAMERA_TSA_TRY_ACQUIRE(true)
66 return lock_.try_lock();
69 void unlock() LIBCAMERA_TSA_RELEASE()
75 friend class ConditionVariable;
77 std::unique_lock<std::mutex> lock_;
80 class ConditionVariable final
83 void notify_one() noexcept
88 void notify_all() noexcept
93 template<
class Predicate>
94 void wait(MutexLocker &locker, Predicate stopWaiting)
96 cv_.wait(locker.lock_, stopWaiting);
99 template<
class Rep,
class Period,
class Predicate>
100 bool wait_for(MutexLocker &locker,
101 const std::chrono::duration<Rep, Period> &relTime,
102 Predicate stopWaiting)
104 return cv_.wait_for(locker.lock_, relTime, stopWaiting);
108 std::condition_variable cv_;
std::mutex wrapper with clang thread safety annotation
Definition: mutex.h:113
Top-level libcamera namespace.
Definition: backtrace.h:17
std::unique_lock wrapper with clang thread safety annotation
Definition: mutex.h:117
std::condition_variable wrapper integrating with MutexLocker
Definition: mutex.h:121