CppCMS
Public Member Functions | List of all members
booster::recursive_mutex Class Reference

Recursive mutex object. More...

#include <booster/booster/thread.h>

Inheritance diagram for booster::recursive_mutex:
booster::noncopyable

Public Member Functions

void lock ()
 
void unlock ()
 

Detailed Description

Recursive mutex object.

Unlike mutex, when the same thread tries to lock the mutex that is already locked it would succeed and would require to unlock it same times it was locked.

Useful for handling objects locks when the order of functions calls is not known in advice. For example

void foo()
{
unique_lock<recursive_mutex> guard(this->lock);
bar();
baz();
}
void bar()
{
unique_lock<recursive_mutex> guard(this->lock);
...
}
See also
unique_lock
shared_lock

Member Function Documentation

void booster::recursive_mutex::lock ( )

Lock the mutex.

See also
unique_lock
void booster::recursive_mutex::unlock ( )

Unlock the mutex,

See also
unique_lock

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