rstd 0.1.0
Loading...
Searching...
No Matches
rstd::sync::Mutex< T > Class Template Referenceexport
module rstd

A mutual exclusion primitive useful for protecting shared data. More...

Public Member Functions

 Mutex (T initial_data)
 Creates a new mutex wrapping the given data.
 
auto lock_mut () const -> Result< MutexGuard< T >, empty >
 Acquires the mutex, blocking the current thread until it is able to do so.
 
auto lock () const -> Result< MutexGuard< T >, empty >
 Acquires the mutex (alias for lock_mut; no poisoning support yet).
 

Detailed Description

template<typename T>
class rstd::sync::Mutex< T >

A mutual exclusion primitive useful for protecting shared data.

Template Parameters
TThe type of the data protected by this mutex.

Constructor & Destructor Documentation

◆ Mutex()

template<typename T >
rstd::sync::Mutex< T >::Mutex ( T initial_data)
inline

Creates a new mutex wrapping the given data.

Parameters
initial_dataThe initial value to protect.

Member Function Documentation

◆ lock_mut()

template<typename T >
auto rstd::sync::Mutex< T >::lock_mut ( ) const -> Result<MutexGuard<T>, empty>
inline

Acquires the mutex, blocking the current thread until it is able to do so.

Returns
A MutexGuard providing mutable access to the protected data.

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