#include <system-mutex.h>
Public Member Functions | |
void | Lock () |
void | Unlock () |
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.
void ns3::SystemMutex::Lock | ( | ) |
Acquire ownership of the Mutual Exclusion object.
void ns3::SystemMutex::Unlock | ( | ) |
Release ownership of the Mutual Exclusion object.