C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
VSN::Mutex Class Reference

Mutex class is a synchronization primitive that can be used to protect the shared data from simultaneous access of several streams. In case of recursive one, Mutex class can be used to protect the common data from simultaneous access of several streams. More...

#include <vsn_mutex.h>

Inherited by VSN::RecursiveMutex.

Public Member Functions

 Mutex (RecursionMode mode=NonRecursive)
 Default constructor.
 
 ~Mutex ()
 Destructor.
 
bool IsRecursive ()
 Returns recursion flag.
 
void Lock ()
 Blocks mutex. Performing stops if mutex is not available.
 
void lock ()
 Blocks mutex. Perfoming stops if mutex is not available.
 
bool TryLock ()
 Tries to block mutex. Returned if mutex is not available.
 
void Unlock ()
 Unlocks mutex.
 
void unlock ()
 Unlocks mutex.
 

Detailed Description

Mutex class is a synchronization primitive that can be used to protect the shared data from simultaneous access of several streams. In case of recursive one, Mutex class can be used to protect the common data from simultaneous access of several streams.

If non-recursive semantics of ownership (recursive is equal to false): The calling stream owns mutex since successful calling Lock and Trylock and till calling Unlock. While the stream owns mutex, all the rest of streams are blocked, if an attempt of owning it, when calling Lock or get false value when calling Trylock. The calling stream mustn't own mutex before calling Lock or Trylock.

If recursive semantics of ownership (recursive is equal to true): The calling stream owns recursive_mutex for a certain period that starts when it calls successfully Lock or Trylock. For this period the stream can make additional calls of Lock and Trylock. Period of ownership finishes when the stream makes the corresponding request quantity to Unlock. When the stream owns mutex, all the rest of streams will be blocked (when calling Lock) or return false value when calling Trylock.


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