MVault 0.0.1
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mvlt::ReadWriteMutex Class Reference

A class for synchronizing threads. More...

#include <ReadWriteMutex.h>

Public Member Functions

 ReadWriteMutex () noexcept
 Default constructor.
 
void Disable () noexcept
 A function to disable the mutex. It is needed so that you can disable the mutex during inheritance.
 
void ReadLock () noexcept
 A method for locking a section of code for reading.
 
void ReadUnlock () noexcept
 A method for unlocking a section of code for reading.
 
void WriteLock () noexcept
 A method for locking a section of code for writing.
 
void WriteUnlock () noexcept
 A method for unlocking a section of code for writing.
 

Detailed Description

A class for synchronizing threads.

A class for thread management that allows you to lock sections of code for reading or writing. A write lock will ensure that there can only be one thread in the code section at a time. The read lock will ensure that no thread using the write lock gets into the code section until all threads using the read lock are unblocked. At the same time, after the write lock, no new threads with a read lock will enter the code section until all threads using the write lock are unblocked.

Member Function Documentation

◆ ReadLock()

void mvlt::ReadWriteMutex::ReadLock ( )
noexcept

A method for locking a section of code for reading.

Using this method, you can lock the code section for reading, which means that all threads using the read lock will have access to data inside the code section but threads using the write lock will wait until all read operations are completed.

◆ WriteLock()

void mvlt::ReadWriteMutex::WriteLock ( )
noexcept

A method for locking a section of code for writing.

This method provides exclusive access to a section of code for a single thread. All write operations will be performed sequentially. This method takes precedence over the read lock, which means that after calling this method, no new read operations will be started.


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