FreeRTOS Addons
Loading...
Searching...
No Matches
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:
cpp_freertos::ReadWriteLockPreferReader cpp_freertos::ReadWriteLockPreferWriter

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.

Constructor & Destructor Documentation

◆ ReadWriteLock()

ReadWriteLock::ReadWriteLock ( )

Constructor

Exceptions
ReadWriteLockCreateExceptionon failure.

◆ ~ReadWriteLock()

ReadWriteLock::~ReadWriteLock ( )
virtual

Destructor

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::ReadWriteLockPreferReader, and cpp_freertos::ReadWriteLockPreferWriter.

◆ 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::ReadWriteLockPreferReader, and cpp_freertos::ReadWriteLockPreferWriter.

◆ 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.

◆ ReadLock

SemaphoreHandle_t cpp_freertos::ReadWriteLock::ReadLock
protected

Protect ReadCount.

◆ 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.


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