Scopira  20080306
scopira::tool::mutex Class Reference

#include <mutex_pthreads.h>

Public Member Functions

 mutex (void)
 basi
 
void lock (void)
 
void unlock (void)
 
bool try_lock (void)
 
pthread_mutex_t * get_os_mutex (void)
 
 mutex (void)
 basi
 
void lock (void)
 
void unlock (void)
 
bool try_lock (void)
 
QMutex * get_os_mutex (void)
 

Protected Attributes

pthread_mutex_t dm_mut
 
QMutex dm_mut
 

Detailed Description

A mutex is a MUTual EXclusion device, and is useful for protecting shared data structures from concurrent modifications, and implementing critical sections and monitors.

Author
Aleksander Demko

Member Function Documentation

◆ get_os_mutex() [1/2]

QMutex* scopira::tool::mutex::get_os_mutex ( void  )
inline

Returns the internal operating system primitive.

Author
Aleksander Demko

◆ get_os_mutex() [2/2]

pthread_mutex_t* scopira::tool::mutex::get_os_mutex ( void  )
inline

Returns the internal operating system primitive.

Author
Aleksander Demko

◆ lock() [1/2]

void scopira::tool::mutex::lock ( void  )
inline

Aquires and locks the mutex. The call blocks if its locked by another thread.

Author
Aleksander Demko

◆ lock() [2/2]

void scopira::tool::mutex::lock ( void  )
inline

Aquires and locks the mutex. The call blocks if its locked by another thread.

Author
Aleksander Demko

Referenced by scopira::tool::locker::locker(), and scopira::tool::locker_ptr< T >::locker_ptr().

◆ try_lock() [1/2]

bool scopira::tool::mutex::try_lock ( void  )
inline

Bahaves just like lock(), except that if the mutex is already locked, this function will return false rather than perform a blocking wait.

True will be returned if the lock was aquired. Don't forget to unlock() it.

Author
Aleksander Demko

◆ try_lock() [2/2]

bool scopira::tool::mutex::try_lock ( void  )
inline

Bahaves just like lock(), except that if the mutex is already locked, this function will return false rather than perform a blocking wait.

True will be returned if the lock was aquired. Don't forget to unlock() it.

Author
Aleksander Demko

◆ unlock() [1/2]

void scopira::tool::mutex::unlock ( void  )
inline

Unlocks a previously locked mutex. Always make sure you match your locks and unlocks (use the locker utility for help)

Author
Aleksander Demko

◆ unlock() [2/2]

void scopira::tool::mutex::unlock ( void  )
inline

Unlocks a previously locked mutex. Always make sure you match your locks and unlocks (use the locker utility for help)

Author
Aleksander Demko

Referenced by scopira::tool::locker::~locker(), and scopira::tool::locker_ptr< T >::~locker_ptr().


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