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
30 void lock() LIBCAMERA_TSA_ACQUIRE()
35 void unlock() LIBCAMERA_TSA_RELEASE()
41 friend class MutexLocker;
46 class LIBCAMERA_TSA_SCOPED_CAPABILITY MutexLocker final
49 explicit MutexLocker(Mutex &mutex) LIBCAMERA_TSA_ACQUIRE(mutex)
54 MutexLocker(Mutex &mutex, std::defer_lock_t t) noexcept LIBCAMERA_TSA_EXCLUDES(mutex)
55 : lock_(mutex.mutex_, t)
59 ~MutexLocker() LIBCAMERA_TSA_RELEASE()
63 void lock() LIBCAMERA_TSA_ACQUIRE()
68 bool try_lock() LIBCAMERA_TSA_TRY_ACQUIRE(true)
70 return lock_.try_lock();
73 void unlock() LIBCAMERA_TSA_RELEASE()
79 friend class ConditionVariable;
81 std::unique_lock<std::mutex> lock_;
84 class ConditionVariable final
91 void notify_one() noexcept
96 void notify_all() noexcept
101 template<
class Predicate>
102 void wait(MutexLocker &locker, Predicate stopWaiting)
104 cv_.wait(locker.lock_, stopWaiting);
107 template<
class Rep,
class Period,
class Predicate>
108 bool wait_for(MutexLocker &locker,
109 const std::chrono::duration<Rep, Period> &relTime,
110 Predicate stopWaiting)
112 return cv_.wait_for(locker.lock_, relTime, stopWaiting);
116 std::condition_variable cv_;
std::mutex wrapper with clang thread safety annotation
Definition: mutex.h:121
Top-level libcamera namespace.
Definition: backtrace.h:17
std::unique_lock wrapper with clang thread safety annotation
Definition: mutex.h:125
std::condition_variable wrapper integrating with MutexLocker
Definition: mutex.h:129