B2BITS FIX Antenna C++ 2.33.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
System::Mutex Class Reference

Mutex - provides synchronization, the ability to control how threads share resources. More...

#include <B2BITS_Mutex.h>

Public Member Functions

void lock ()
 Locks the mutex.
 
 Mutex ()
 Constructor.
 
 Mutex (char const *name)
 Constructor.
 
 Mutex (std::string const &name)
 Constructor.
 
char const * name () const throw ()
 
bool try_lock ()
 Tries to acquire lock without blocking.
 
bool tryLock ()
 Tries to acquire lock without blocking.
 
void unlock ()
 Unlocks the mutex.
 
 ~Mutex ()
 Destructor.
 

Friends

class Condition
 
class Utils::CTGuard< Mutex >
 

Detailed Description

Mutex - provides synchronization, the ability to control how threads share resources.

You use mutexes to prevent multiple threads from modifying shared data at the same time, and to ensure that a thread can read consistent values for a set of resources (for example, memory) that may be modified by other threads.

Constructor & Destructor Documentation

◆ Mutex() [1/3]

System::Mutex::Mutex ( std::string const & name)
explicit

Constructor.

◆ Mutex() [2/3]

System::Mutex::Mutex ( char const * name)
explicit

Constructor.

◆ Mutex() [3/3]

System::Mutex::Mutex ( )

Constructor.

◆ ~Mutex()

System::Mutex::~Mutex ( )

Destructor.

Member Function Documentation

◆ lock()

void System::Mutex::lock ( )

Locks the mutex.

If the mutex is currently locked, the calling thread is blocked until mutex is unlocked. On return, the thread owns the mutex until it calls Mutex::unlock().

Referenced by System::ThreadSafe::MutexGuard< T >::MutexGuard().

◆ name()

char const * System::Mutex::name ( ) const
throw ( )
inline

◆ try_lock()

bool System::Mutex::try_lock ( )
inline

Tries to acquire lock without blocking.

This function is identical to tryLock and it's sole purpose is to make Mutex compatible with Boost's Lockable concept.

Returns
true if lock was acquired; false otherwise.

◆ tryLock()

bool System::Mutex::tryLock ( )

Tries to acquire lock without blocking.

Returns
true if lock was acquired; false otherwise.

◆ unlock()

void System::Mutex::unlock ( )

Unlocks the mutex.

The mutex becomes unowned. If any threads are waiting for the mutex, one is awakened.

Referenced by System::ThreadSafe::MutexGuard< T >::~MutexGuard().

Friends And Related Symbol Documentation

◆ Condition

friend class Condition
friend

◆ Utils::CTGuard< Mutex >

friend class Utils::CTGuard< Mutex >
friend