A Discrete-Event Network Simulator
API
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
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 43 of file unix-system-condition.cc.

Constructor & Destructor Documentation

◆ SystemConditionPrivate()

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.

◆ ~SystemConditionPrivate()

ns3::SystemConditionPrivate::~SystemConditionPrivate ( )

Destructor.

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

References m_cond, m_mutex, and NS_LOG_FUNCTION.

Member Function Documentation

◆ Broadcast()

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

◆ GetCondition()

bool ns3::SystemConditionPrivate::GetCondition ( void  )

Get the condition value.

Returns
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().

◆ SetCondition()

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

Set the condition.

Parameters
[in]conditionThe 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().

◆ Signal()

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

◆ TimedWait()

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

◆ Wait()

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

Member Data Documentation

◆ m_cond

pthread_cond_t ns3::SystemConditionPrivate::m_cond
private

The pthread condition variable.

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

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

◆ m_condition

bool ns3::SystemConditionPrivate::m_condition
private

The condition state.

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

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

◆ m_mutex

pthread_mutex_t ns3::SystemConditionPrivate::m_mutex
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().

◆ NS_PER_SEC

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

Conversion from ns to s.

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

Referenced by TimedWait().


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