carb::tasking::SharedMutexWrapper
Defined in carb/tasking/TaskingUtils.h
-
class SharedMutexWrapper
Wrapper for a carb::tasking::SharedMutex that (mostly) conforms to C++ Named Requirements of SharedMutex.
Public Functions
-
inline SharedMutexWrapper()
Constructs a new SharedMutexWrapper object.
-
inline SharedMutexWrapper(ITasking*)
Constructs a new SharedMutexWrapper object.
Note
Deprecated: ITasking no longer needed.
-
inline ~SharedMutexWrapper()
Destructor.
Note
It is an error to destroy a shared mutex that is locked.
-
inline bool try_lock_shared()
Attempts to shared-lock the shared mutex immediately.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
- Returns
true if the mutex was shared-locked; false otherwise
-
inline bool try_lock()
Attempts to exclusive-lock the shared mutex immediately.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
- Returns
true if the mutex was shared-locked; false otherwise
-
template<class Rep, class Period>
inline bool try_lock_for(const std::chrono::duration<Rep, Period> &duration) Attempts to exclusive-lock the shared mutex within a specified duration.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
- Parameters
duration – The duration to wait for the mutex to be available
- Returns
true if the mutex was exclusive-locked; false if the timeout period expired
-
template<class Rep, class Period>
inline bool try_lock_shared_for(const std::chrono::duration<Rep, Period> &duration) Attempts to shared-lock the shared mutex within a specified duration.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
- Parameters
duration – The duration to wait for the mutex to be available
- Returns
true if the mutex was shared-locked; false if the timeout period expired
-
template<class Clock, class Duration>
inline bool try_lock_until(const std::chrono::time_point<Clock, Duration> &time_point) Attempts to exclusive-lock the shared mutex until a specific clock time.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
- Parameters
time_point – The clock time to wait until.
- Returns
true if the mutex was exclusive-locked; false if the timeout period expired
-
template<class Clock, class Duration>
inline bool try_lock_shared_until(const std::chrono::time_point<Clock, Duration> &time_point) Attempts to shared-lock the shared mutex until a specific clock time.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
- Parameters
time_point – The clock time to wait until.
- Returns
true if the mutex was shared-locked; false if the timeout period expired
-
inline void lock_shared()
Shared-locks the shared mutex, waiting until it becomes available.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
-
inline void unlock_shared()
Unlocks a mutex previously shared-locked by this thread/task.
Note
It is undefined behavior to unlock a mutex that is not owned by the current thread or task.
-
inline void lock()
Exclusive-locks the shared mutex, waiting until it becomes available.
Note
It is an error to lock recursively or shared-lock when exclusive-locked, or vice versa.
-
inline void unlock()
Unlocks a mutex previously exclusive-locked by this thread/task.
Note
It is undefined behavior to unlock a mutex that is not owned by the current thread or task.
-
inline operator SharedMutex*() const
Convertible to SharedMutex*.
-
inline ITasking *getTasking() const
Returns the acquired ITasking interface that was used to construct this object.
Note
Deprecated: Use carb::getCachedInterface instead.
-
inline SharedMutexWrapper()