libzypp  10.5.0
zypp::thread::Mutex Class Reference

A recursive Mutex. More...

#include <Mutex.h>

Inheritance diagram for zypp::thread::Mutex:

List of all members.

Public Member Functions

 Mutex ()
 Create a new recursive Mutex object.
 ~Mutex ()
 Destroys this Mutex object.
void lock ()
 Acquire ownership of this Mutex object.
void unlock ()
 Release ownership of this Mutex object.
bool trylock ()
 Try to acquire ownership of this Mutex object.

Private Attributes

RecursiveMutex_t m_mutex

Detailed Description

A recursive Mutex.

Definition at line 35 of file Mutex.h.


Constructor & Destructor Documentation

zypp::thread::Mutex::Mutex ( )

Create a new recursive Mutex object.

Exceptions:
MutexExceptionon initialization failure.

Definition at line 25 of file Mutex.cc.

zypp::thread::Mutex::~Mutex ( )

Destroys this Mutex object.

Definition at line 52 of file Mutex.cc.


Member Function Documentation

void zypp::thread::Mutex::lock ( )

Acquire ownership of this Mutex object.

This call will block if another thread has ownership of this Mutex. When it returns, the current thread is the owner of this Mutex object.

In the same thread, this recursive mutex can be acquired multiple times.

Exceptions:
MutexExceptionif the maximum number of recursive locks for mutex has been exceeded.

Definition at line 72 of file Mutex.cc.

void zypp::thread::Mutex::unlock ( )

Release ownership of this Mutex object.

If another thread is waiting to acquire the ownership of this mutex it will stop blocking and acquire ownership when this call returns.

Exceptions:
MutexExceptionif the current thread does not own the mutex.

Definition at line 82 of file Mutex.cc.

bool zypp::thread::Mutex::trylock ( )

Try to acquire ownership of this Mutex object.

This call will return false if another thread has ownership of this Mutex or the maximum number of recursive locks for mutex has been exceeded. When it returns true, the current thread is the owner of this Mutex object.

Returns:
true, if ownership was acquired.

Definition at line 92 of file Mutex.cc.


Member Data Documentation

Definition at line 82 of file Mutex.h.


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