deal.II version GIT relicensing-2165-gc91f007519 2024-11-20 01:40:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Threads::Mutex Class Reference

#include <deal.II/base/mutex.h>

Inheritance diagram for Threads::Mutex:
Inheritance graph
[legend]

Public Member Functions

 Mutex ()=default
 
 Mutex (const Mutex &)
 
Mutexoperator= (const Mutex &)
 

Detailed Description

A class implementing a mutex. Mutexes are used to lock data structures to ensure that only a single thread of execution can access them at the same time.

This class is a thin wrapper around std::mutex. The only difference is that this class is copyable when std::mutex is not. Indeed, when copied, the receiving object does not copy any state from the object being copied, i.e. an entirely new mutex is created. These semantics are consistent with the common use case if a mutex is used as a member variable to lock the other member variables of a class: in that case, the mutex of the copied-to object should only guard the members of the copied-to object, not the members of both the copied-to and copied-from object. Since at the time when the class is copied, the destination's member variable is not used yet, its corresponding mutex should also remain in its original state.

Definition at line 50 of file mutex.h.

Constructor & Destructor Documentation

◆ Mutex() [1/2]

Threads::Mutex::Mutex ( )
default

Default constructor.

◆ Mutex() [2/2]

Threads::Mutex::Mutex ( const Mutex )
inline

Copy constructor. As discussed in this class's documentation, no state is copied from the object given as argument.

Definition at line 62 of file mutex.h.

Member Function Documentation

◆ operator=()

Mutex & Threads::Mutex::operator= ( const Mutex )
inline

Copy operators. As discussed in this class's documentation, no state is copied from the object given as argument.

Definition at line 71 of file mutex.h.


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