FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Public Member Functions | Protected Attributes | List of all members
cpp_freertos::ReadWriteLock Class Referenceabstract

#include <read_write_lock.hpp>

Inheritance diagram for cpp_freertos::ReadWriteLock:
Inheritance graph
[legend]

Public Member Functions

 ReadWriteLock ()
 
virtual ~ReadWriteLock ()
 
virtual void ReaderLock ()=0
 
virtual void ReaderUnlock ()=0
 
virtual void WriterLock ()=0
 
virtual void WriterUnlock ()=0
 

Protected Attributes

int ReadCount
 
SemaphoreHandle_t ReadLock
 
SemaphoreHandle_t ResourceLock
 

Detailed Description

Abstract base class encapsulating a Reader/Writer lock.

These locks are based on mutexs and cannot be used in any way from ISR context. Likewise, these locks block indefinitely.

Note
It is expected that an application will instantiate one of the derived classes and use that object for synchronization. It is not expected that a user or application will derive from these classes.

Definition at line 110 of file read_write_lock.hpp.

Constructor & Destructor Documentation

◆ ReadWriteLock()

ReadWriteLock::ReadWriteLock ( )

Constructor

Exceptions
ReadWriteLockCreateExceptionon failure.

Definition at line 46 of file cread_write_lock.cpp.

◆ ~ReadWriteLock()

ReadWriteLock::~ReadWriteLock ( )
virtual

Destructor

Definition at line 82 of file cread_write_lock.cpp.

Member Function Documentation

◆ ReaderLock()

virtual void cpp_freertos::ReadWriteLock::ReaderLock ( )
pure virtual

Take the lock as a Reader. This allows multiple reader access.

Implemented in cpp_freertos::ReadWriteLockPreferWriter, and cpp_freertos::ReadWriteLockPreferReader.

◆ ReaderUnlock()

virtual void cpp_freertos::ReadWriteLock::ReaderUnlock ( )
pure virtual

◆ WriterLock()

virtual void cpp_freertos::ReadWriteLock::WriterLock ( )
pure virtual

Take the lock as a Writer. This allows only one thread access.

Implemented in cpp_freertos::ReadWriteLockPreferWriter, and cpp_freertos::ReadWriteLockPreferReader.

◆ WriterUnlock()

virtual void cpp_freertos::ReadWriteLock::WriterUnlock ( )
pure virtual

Member Data Documentation

◆ ReadCount

int cpp_freertos::ReadWriteLock::ReadCount
protected

How many active readers are there.

Definition at line 162 of file read_write_lock.hpp.

◆ ReadLock

SemaphoreHandle_t cpp_freertos::ReadWriteLock::ReadLock
protected

Protect ReadCount.

Definition at line 167 of file read_write_lock.hpp.

◆ ResourceLock

SemaphoreHandle_t cpp_freertos::ReadWriteLock::ResourceLock
protected

Protect this resource from multiple writer access, or from Reader access when a writer is changing something.

Definition at line 173 of file read_write_lock.hpp.


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