A Discrete-Event Network Simulator
API
ns3::SystemConditionPrivate Class Reference

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...
 

Detailed Description

Implementation of SystemCondition for Unix-like systems.

Definition at line 42 of file unix-system-condition.cc.

Constructor & Destructor Documentation

ns3::SystemConditionPrivate::SystemConditionPrivate ( )

Constructor.

Definition at line 91 of file unix-system-condition.cc.

References m_cond, m_condition, m_mutex, and NS_LOG_FUNCTION.

ns3::SystemConditionPrivate::~SystemConditionPrivate ( )

Destructor.

Definition at line 116 of file unix-system-condition.cc.

References m_cond, m_mutex, and NS_LOG_FUNCTION.

Member Function Documentation

void ns3::SystemConditionPrivate::Broadcast ( void  )

Broadcast the condition.

Definition at line 148 of file unix-system-condition.cc.

References m_cond, m_mutex, and NS_LOG_FUNCTION.

Referenced by ns3::SystemCondition::Broadcast().

+ Here is the caller graph for this function:

bool ns3::SystemConditionPrivate::GetCondition ( void  )

Get the condition value.

Returns
The condition value.

Definition at line 131 of file unix-system-condition.cc.

References m_condition, and NS_LOG_FUNCTION.

Referenced by ns3::SystemCondition::GetCondition().

+ Here is the caller graph for this function:

void ns3::SystemConditionPrivate::SetCondition ( bool  condition)

Set the condition.

Parameters
[in]conditionThe new condition value.

Definition at line 124 of file unix-system-condition.cc.

References m_condition, and NS_LOG_FUNCTION.

Referenced by ns3::SystemCondition::SetCondition().

+ Here is the caller graph for this function:

void ns3::SystemConditionPrivate::Signal ( void  )

Signal the condition.

Definition at line 138 of file unix-system-condition.cc.

References m_cond, m_mutex, and NS_LOG_FUNCTION.

Referenced by ns3::SystemCondition::Signal().

+ Here is the caller graph for this function:

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.

Parameters
[in]nsMaximum time to wait, in ns.
Returns
true if the condition timed out; false if the other thread set it.

Definition at line 172 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().

+ Here is the caller graph for this function:

void ns3::SystemConditionPrivate::Wait ( void  )

Unset the condition, then wait for another thread to set it with SetCondition.

Definition at line 158 of file unix-system-condition.cc.

References m_cond, m_condition, m_mutex, and NS_LOG_FUNCTION.

Referenced by ns3::SystemCondition::Wait().

+ Here is the caller graph for this function:

Member Data Documentation

pthread_cond_t ns3::SystemConditionPrivate::m_cond
private

The pthread condition variable.

Definition at line 86 of file unix-system-condition.cc.

Referenced by Broadcast(), Signal(), SystemConditionPrivate(), TimedWait(), Wait(), and ~SystemConditionPrivate().

bool ns3::SystemConditionPrivate::m_condition
private

The condition state.

Definition at line 88 of file unix-system-condition.cc.

Referenced by GetCondition(), SetCondition(), SystemConditionPrivate(), TimedWait(), and Wait().

pthread_mutex_t ns3::SystemConditionPrivate::m_mutex
private

Mutex controlling access to the condition.

Definition at line 84 of file unix-system-condition.cc.

Referenced by Broadcast(), Signal(), SystemConditionPrivate(), TimedWait(), Wait(), and ~SystemConditionPrivate().

const uint64_t ns3::SystemConditionPrivate::NS_PER_SEC = (uint64_t)1000000000
static

Conversion from ns to s.

Definition at line 45 of file unix-system-condition.cc.

Referenced by TimedWait().


The documentation for this class was generated from the following file: