Implementation of SystemCondition for Unix-like systems. More...
Public Member Functions | |
SystemConditionPrivate () | |
Constructor. More... | |
~SystemConditionPrivate () | |
Destructor. More... | |
void | Broadcast (void) |
Broadcast the condition. More... | |
bool | GetCondition (void) |
Get the condition value. More... | |
void | SetCondition (bool condition) |
Set the condition. More... | |
void | Signal (void) |
Signal the condition. More... | |
bool | TimedWait (uint64_t ns) |
Unset the condition, then wait for a limited amount of wall-clock time for another thread to set it with SetCondition. More... | |
void | Wait (void) |
Unset the condition, then wait for another thread to set it with SetCondition. More... | |
Static Public Attributes | |
static const uint64_t | NS_PER_SEC = (uint64_t)1000000000 |
Conversion from ns to s. More... | |
Private Attributes | |
pthread_cond_t | m_cond |
The pthread condition variable. More... | |
bool | m_condition |
The condition state. More... | |
pthread_mutex_t | m_mutex |
Mutex controlling access to the condition. More... | |
Implementation of SystemCondition for Unix-like systems.
Definition at line 43 of file unix-system-condition.cc.
ns3::SystemConditionPrivate::SystemConditionPrivate | ( | ) |
Constructor.
Definition at line 92 of file unix-system-condition.cc.
References m_cond, m_condition, m_mutex, and NS_LOG_FUNCTION.
ns3::SystemConditionPrivate::~SystemConditionPrivate | ( | ) |
Destructor.
Definition at line 117 of file unix-system-condition.cc.
References m_cond, m_mutex, and NS_LOG_FUNCTION.
void ns3::SystemConditionPrivate::Broadcast | ( | void | ) |
Broadcast the condition.
Definition at line 149 of file unix-system-condition.cc.
References m_cond, m_mutex, and NS_LOG_FUNCTION.
Referenced by ns3::SystemCondition::Broadcast().
bool ns3::SystemConditionPrivate::GetCondition | ( | void | ) |
Get the condition value.
Definition at line 132 of file unix-system-condition.cc.
References m_condition, and NS_LOG_FUNCTION.
Referenced by ns3::SystemCondition::GetCondition().
void ns3::SystemConditionPrivate::SetCondition | ( | bool | condition | ) |
Set the condition.
[in] | condition | The new condition value. |
Definition at line 125 of file unix-system-condition.cc.
References m_condition, and NS_LOG_FUNCTION.
Referenced by ns3::SystemCondition::SetCondition().
void ns3::SystemConditionPrivate::Signal | ( | void | ) |
Signal the condition.
Definition at line 139 of file unix-system-condition.cc.
References m_cond, m_mutex, and NS_LOG_FUNCTION.
Referenced by ns3::SystemCondition::Signal().
bool ns3::SystemConditionPrivate::TimedWait | ( | uint64_t | ns | ) |
Unset the condition, then wait for a limited amount of wall-clock time for another thread to set it with SetCondition.
[in] | ns | Maximum time to wait, in ns. |
true
if the condition timed out; false
if the other thread set it. Definition at line 173 of file unix-system-condition.cc.
References m_cond, m_condition, m_mutex, NS_LOG_FUNCTION, and NS_PER_SEC.
Referenced by ns3::SystemCondition::TimedWait().
void ns3::SystemConditionPrivate::Wait | ( | void | ) |
Unset the condition, then wait for another thread to set it with SetCondition.
Definition at line 159 of file unix-system-condition.cc.
References m_cond, m_condition, m_mutex, and NS_LOG_FUNCTION.
Referenced by ns3::SystemCondition::Wait().
|
private |
The pthread condition variable.
Definition at line 87 of file unix-system-condition.cc.
Referenced by Broadcast(), Signal(), SystemConditionPrivate(), TimedWait(), Wait(), and ~SystemConditionPrivate().
|
private |
The condition state.
Definition at line 89 of file unix-system-condition.cc.
Referenced by GetCondition(), SetCondition(), SystemConditionPrivate(), TimedWait(), and Wait().
|
private |
Mutex controlling access to the condition.
Definition at line 85 of file unix-system-condition.cc.
Referenced by Broadcast(), Signal(), SystemConditionPrivate(), TimedWait(), Wait(), and ~SystemConditionPrivate().
|
static |
Conversion from ns to s.
Definition at line 46 of file unix-system-condition.cc.
Referenced by TimedWait().