10#include <condition_variable>
13#include <libcamera/base/thread_annotations.h>
21class LIBCAMERA_TSA_CAPABILITY("mutex") Mutex final
28 void lock() LIBCAMERA_TSA_ACQUIRE()
33 void unlock() LIBCAMERA_TSA_RELEASE()
39 friend class MutexLocker;
44class LIBCAMERA_TSA_SCOPED_CAPABILITY MutexLocker final
47 explicit MutexLocker(Mutex &mutex) LIBCAMERA_TSA_ACQUIRE(mutex)
52 MutexLocker(Mutex &mutex, std::defer_lock_t t)
noexcept LIBCAMERA_TSA_EXCLUDES(mutex)
53 : lock_(mutex.mutex_, t)
57 ~MutexLocker() LIBCAMERA_TSA_RELEASE()
61 void lock() LIBCAMERA_TSA_ACQUIRE()
66 bool try_lock() LIBCAMERA_TSA_TRY_ACQUIRE(true)
68 return lock_.try_lock();
71 void unlock() LIBCAMERA_TSA_RELEASE()
77 friend class ConditionVariable;
79 std::unique_lock<std::mutex> lock_;
82class ConditionVariable final
89 void notify_one() noexcept
94 void notify_all() noexcept
99 template<
class Predicate>
100 void wait(MutexLocker &locker, Predicate stopWaiting)
102 cv_.wait(locker.lock_, stopWaiting);
105 template<
class Rep,
class Period,
class Predicate>
106 bool wait_for(MutexLocker &locker,
107 const std::chrono::duration<Rep, Period> &relTime,
108 Predicate stopWaiting)
110 return cv_.wait_for(locker.lock_, relTime, stopWaiting);
114 std::condition_variable cv_;
std::condition_variable wrapper integrating with MutexLocker
Definition: mutex.h:128
std::unique_lock wrapper with clang thread safety annotation
Definition: mutex.h:124
std::mutex wrapper with clang thread safety annotation
Definition: mutex.h:120
Top-level libcamera namespace.
Definition: backtrace.h:17