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 43 of file unix-system-condition.cc.

Constructor & Destructor Documentation

◆ SystemConditionPrivate()

ns3::SystemConditionPrivate::SystemConditionPrivate ( )

Constructor.

Definition at line 93 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 118 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 150 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:

◆ GetCondition()

bool ns3::SystemConditionPrivate::GetCondition ( void  )

Get the condition value.

Returns
The condition value.

Definition at line 133 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:

◆ SetCondition()

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

Set the condition.

Parameters
[in]conditionThe new condition value.

Definition at line 126 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:

◆ Signal()

void ns3::SystemConditionPrivate::Signal ( void  )

Signal the condition.

Definition at line 140 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:

◆ 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 174 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:

◆ Wait()

void ns3::SystemConditionPrivate::Wait ( void  )

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

Definition at line 160 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

◆ m_cond

pthread_cond_t ns3::SystemConditionPrivate::m_cond
private

The pthread condition variable.

Definition at line 88 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 90 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 86 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 47 of file unix-system-condition.cc.

Referenced by TimedWait().


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