PMDK C++ bindings
1.6.1
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Persistent memory resident condition variable. More...
#include <libpmemobj++/condition_variable.hpp>
Public Types | |
typedef PMEMcond * | native_handle_type |
The handle typedef to the underlying basic type. | |
Public Member Functions | |
condition_variable () | |
Default constructor. More... | |
~condition_variable ()=default | |
Defaulted destructor. | |
void | notify_one () |
Notify and unblock one thread waiting on *this condition. More... | |
void | notify_all () |
Notify and unblock all threads waiting on *this condition. More... | |
void | wait (mutex &lock) |
Makes the current thread block until the condition variable is notified or it is woken up by some other measure. More... | |
template<typename Lock > | |
void | wait (Lock &lock) |
Makes the current thread block until the condition variable is notified or it is woken up by some other measure. More... | |
template<typename Predicate > | |
void | wait (mutex &lock, Predicate pred) |
Makes the current thread block until the condition variable is notified. More... | |
template<typename Lock , typename Predicate > | |
void | wait (Lock &lock, Predicate pred) |
Makes the current thread block until the condition variable is notified. More... | |
template<typename Clock , typename Duration > | |
std::cv_status | wait_until (mutex &lock, const std::chrono::time_point< Clock, Duration > &timeout) |
Makes the current thread block until the condition variable is notified, a specific time is reached or it is woken up by some other measure. More... | |
template<typename Lock , typename Clock , typename Duration > | |
std::cv_status | wait_until (Lock &lock, const std::chrono::time_point< Clock, Duration > &timeout) |
Makes the current thread block until the condition variable is notified, a specific time is reached or it is woken up by some other measure. More... | |
template<typename Clock , typename Duration , typename Predicate > | |
bool | wait_until (mutex &lock, const std::chrono::time_point< Clock, Duration > &timeout, Predicate pred) |
Makes the current thread block until the condition variable is notified or a specific time is reached. More... | |
template<typename Lock , typename Clock , typename Duration , typename Predicate > | |
bool | wait_until (Lock &lock, const std::chrono::time_point< Clock, Duration > &timeout, Predicate pred) |
Makes the current thread block until the condition variable is notified or a specific time is reached. More... | |
template<typename Lock , typename Rep , typename Period > | |
std::cv_status | wait_for (Lock &lock, const std::chrono::duration< Rep, Period > &rel_time) |
Makes the current thread block until the condition variable is notified, the specified amount of time passes or it is woken up by some other measure. More... | |
template<typename Lock , typename Rep , typename Period , typename Predicate > | |
bool | wait_for (Lock &lock, const std::chrono::duration< Rep, Period > &rel_time, Predicate pred) |
Makes the current thread block until the condition variable is notified or the specified amount of time passes. More... | |
template<typename Rep , typename Period > | |
std::cv_status | wait_for (mutex &lock, const std::chrono::duration< Rep, Period > &rel_time) |
Makes the current thread block until the condition variable is notified, the specified amount of time passes or it is woken up by some other measure. More... | |
template<typename Rep , typename Period , typename Predicate > | |
bool | wait_for (mutex &lock, const std::chrono::duration< Rep, Period > &rel_time, Predicate pred) |
Makes the current thread block until the condition variable is notified or the specified amount of time passes. More... | |
native_handle_type | native_handle () noexcept |
Access a native handle to this condition variable. More... | |
condition_variable & | operator= (const condition_variable &)=delete |
Deleted assignment operator. | |
condition_variable (const condition_variable &)=delete | |
Deleted copy constructor. | |
Private Member Functions | |
void | wait_impl (mutex &lock) |
Internal implementation of the wait call. | |
template<typename Predicate > | |
void | wait_impl (mutex &lock, Predicate pred) |
Internal implementation of the wait call. | |
template<typename Clock , typename Duration > | |
std::cv_status | wait_until_impl (mutex &lock, const std::chrono::time_point< Clock, Duration > &abs_timeout) |
Internal implementation of the wait_until call. | |
template<typename Clock , typename Duration , typename Predicate > | |
bool | wait_until_impl (mutex &lock, const std::chrono::time_point< Clock, Duration > &abs_timeout, Predicate pred) |
Internal implementation of the wait_until call. | |
Private Attributes | |
PMEMcond | pcond |
A POSIX style PMEM-resident condition variable. | |
Persistent memory resident condition variable.
This class is an implementation of a PMEM-resident condition variable which mimics in behavior the C++11 std::condition_variable. The typical usage example would be:
|
inline |
Default constructor.
lock_error | when the condition_variable is not from persistent memory. |
|
inlinenoexcept |
Access a native handle to this condition variable.
|
inline |
Notify and unblock all threads waiting on *this
condition.
Does nothing when no threads are waiting.
|
inline |
Notify and unblock one thread waiting on *this
condition.
Does nothing when no threads are waiting. It is unspecified which thread is selected for unblocking.
lock_error | when the signal fails on the pcond. |
|
inline |
Makes the current thread block until the condition variable is notified or it is woken up by some other measure.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a Lock object which meets the BasicLockableConcept. Needs to be based on a PMEM-resident obj::mutex. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait. This version is immune to spurious wake ups due to the provided predicate.
[in,out] | lock | a Lock object which meets the BasicLockableConcept. Needs to be based on a PMEM-resident obj::mutex. |
[in] | pred | predicate which returns false if waiting is to be continued. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified or it is woken up by some other measure.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a PMEM-resident obj::mutex. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait. This version is immune to spurious wake ups due to the provided predicate.
[in,out] | lock | a PMEM-resident obj::mutex. |
[in] | pred | predicate which returns false if waiting is to be continued. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified, the specified amount of time passes or it is woken up by some other measure.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a Lock object which meets the BasicLockableConcept. Needs to be based on a PMEM-resident obj::mutex. |
[in] | rel_time | a specific duration, which when expired unblocks the thread. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified or the specified amount of time passes.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a Lock object which meets the BasicLockableConcept. Needs to be based on a PMEM-resident obj::mutex. |
[in] | rel_time | a specific duration, which when expired unblocks the thread. |
[in] | pred | predicate which returns false if waiting is to be continued. |
false
if pred evaluates to false
after timeout expired, otherwise true
.lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified, the specified amount of time passes or it is woken up by some other measure.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a PMEM-resident obj::mutex. |
[in] | rel_time | a specific duration, which when expired unblocks the thread. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified or the specified amount of time passes.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a PMEM-resident obj::mutex. |
[in] | rel_time | a specific duration, which when expired unblocks the thread. |
[in] | pred | predicate which returns false if waiting is to be continued. |
false
if pred evaluates to false
after timeout expired, otherwise true
.lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified, a specific time is reached or it is woken up by some other measure.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a Lock object which meets the BasicLockableConcept. Needs to be based on a PMEM-resident obj::mutex. |
[in] | timeout | a specific point in time, which when reached unblocks the thread. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified or a specific time is reached.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a Lock object which meets the BasicLockableConcept. Needs to be based on a PMEM-resident obj::mutex. |
[in] | timeout | a specific point in time, which when reached unblocks the thread. |
[in] | pred | predicate which returns false if waiting is to be continued. |
false
if pred evaluates to false
after timeout expired, otherwise true
.lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified, a specific time is reached or it is woken up by some other measure.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a PMEM-resident obj::mutex. |
[in] | timeout | a specific point in time, which when reached unblocks the thread. |
lock_error | when unlocking the lock or waiting on pcond fails. |
|
inline |
Makes the current thread block until the condition variable is notified or a specific time is reached.
This releases the lock, blocks the current thread and adds it to the list of threads waiting on *this
condition variable. The lock needs to be acquired and owned by the calling thread. The lock is automatically reacquired after the call to wait.
[in,out] | lock | a PMEM-resident obj::mutex. |
[in] | timeout | a specific point in time, which when reached unblocks the thread. |
[in] | pred | predicate which returns false if waiting is to be continued. |
false
if pred evaluates to false
after timeout expired, otherwise true
.lock_error | when unlocking the lock or waiting on pcond fails. |