Shaka Player Embedded
Public Member Functions | List of all members
shaka::util::shared_mutex Class Reference

#include <shared_lock.h>

Inheritance diagram for shaka::util::shared_mutex:
shaka::SharedMutex

Public Member Functions

 shared_mutex ()
 
 ~shared_mutex ()
 
 SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE (shared_mutex)
 
void lock ()
 
bool try_lock ()
 
void unlock ()
 
void lock_shared ()
 
bool try_lock_shared ()
 
void unlock_shared ()
 

Detailed Description

A simple implementation of a reader-writer mutex where:

You can use std::unique_lock<T> to help locking this in exclusive mode. For example:

std::unique_lock<shared_mutex> lock(mutex);
// In exclusive mode.

Or you can use shared_lock to lock in shared mode:

shared_lock<shared_mutex> lock(mutex);
// In shared mode.

This implements the Lockable, Mutex, and SharedMutex concepts.

Definition at line 57 of file shared_lock.h.

Constructor & Destructor Documentation

§ shared_mutex()

shaka::util::shared_mutex::shared_mutex ( )

Definition at line 22 of file shared_lock.cc.

§ ~shared_mutex()

shaka::util::shared_mutex::~shared_mutex ( )

Definition at line 28 of file shared_lock.cc.

Member Function Documentation

§ lock()

void shaka::util::shared_mutex::lock ( )
inline

Locks the mutex for exclusive access.

Definition at line 65 of file shared_lock.h.

§ lock_shared()

void shaka::util::shared_mutex::lock_shared ( )
inline

Locks the mutex for shared access.

Definition at line 79 of file shared_lock.h.

§ SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE()

shaka::util::shared_mutex::SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE ( shared_mutex  )

§ try_lock()

bool shaka::util::shared_mutex::try_lock ( )
inline

Tries to lock the mutex for exclusive access in a non-blocking way.

Definition at line 70 of file shared_lock.h.

§ try_lock_shared()

bool shaka::util::shared_mutex::try_lock_shared ( )
inline

Tries to lock the mutex for shared access in a non-blocking way.

Definition at line 84 of file shared_lock.h.

§ unlock()

void shaka::util::shared_mutex::unlock ( )

Unlocks the mutex from exclusive access.

Definition at line 37 of file shared_lock.cc.

§ unlock_shared()

void shaka::util::shared_mutex::unlock_shared ( )

Unlocks the mutex from shared access.

Definition at line 51 of file shared_lock.cc.


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