Scopira 20080306

scopira::tool::mutex Class Reference

#include <mutex_pthreads.h>

List of all members.

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

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

Returns the internal operating system primitive.

Author:
Aleksander Demko
QMutex* scopira::tool::mutex::get_os_mutex ( void  ) [inline]

Returns the internal operating system primitive.

Author:
Aleksander Demko
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().

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

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

Author:
Aleksander Demko
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
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
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().

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

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