CppCMS
Public Member Functions
booster::recursive_mutex Class Reference

Recursive mutex object. More...

#include <booster/booster/thread.h>

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

List of all members.

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

Lock the mutex.

See also:
unique_lock

Unlock the mutex,

See also:
unique_lock

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