A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::SystemMutex Class Reference

A class which provides a relatively platform-independent Mutual Exclusion thread synchronization primitive. More...

#include <system-mutex.h>

+ Collaboration diagram for ns3::SystemMutex:

Public Member Functions

 SystemMutex ()
 
 ~SystemMutex ()
 
void Lock ()
 Acquire ownership of the Mutual Exclusion object. More...
 
void Unlock ()
 Release ownership of the Mutual Exclusion object. More...
 

Private Attributes

SystemMutexPrivatem_priv
 

Detailed Description

A class which provides a relatively platform-independent Mutual Exclusion thread synchronization primitive.

When more than one thread needs to access a shared resource (data structure or device), the system needs to provide a way to serialize access to the resource. An operating system will typically provide a Mutual Exclusion primitive to provide that capability. We provide plattorm-independent access to the OS-dependent capability with the SystemMutex class.

There are two operations: Lock and Unlock. Lock allows an executing SystemThread to attempt to acquire ownership of the Mutual Exclusion object. If the SystemMutex object is not owned by another thread, then ownership is granted to the calling SystemThread and Lock returns immediately, However, if the SystemMutex is already owned by another SystemThread, the calling SystemThread is blocked until the current owner releases the SystemMutex by calling Unlock.

See also
CriticalSection

Definition at line 50 of file system-mutex.h.

Constructor & Destructor Documentation

ns3::SystemMutex::SystemMutex ( )

Definition at line 102 of file unix-system-mutex.cc.

References NS_LOG_FUNCTION.

ns3::SystemMutex::~SystemMutex ( )

Definition at line 108 of file unix-system-mutex.cc.

References m_priv, and NS_LOG_FUNCTION.

Member Function Documentation

void ns3::SystemMutex::Lock ( )

Acquire ownership of the Mutual Exclusion object.

Definition at line 115 of file unix-system-mutex.cc.

References ns3::SystemMutexPrivate::Lock(), m_priv, and NS_LOG_FUNCTION.

Referenced by ns3::CriticalSection::CriticalSection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::SystemMutex::Unlock ( )

Release ownership of the Mutual Exclusion object.

Definition at line 122 of file unix-system-mutex.cc.

References m_priv, NS_LOG_FUNCTION, and ns3::SystemMutexPrivate::Unlock().

Referenced by ns3::CriticalSection::~CriticalSection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

SystemMutexPrivate* ns3::SystemMutex::m_priv
private

Definition at line 67 of file system-mutex.h.

Referenced by Lock(), Unlock(), and ~SystemMutex().


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