FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Public Member Functions | Private Attributes | List of all members
cpp_freertos::ReadWriteLockPreferWriter Class Reference

#include <read_write_lock.hpp>

Inheritance diagram for cpp_freertos::ReadWriteLockPreferWriter:
Inheritance graph
[legend]
Collaboration diagram for cpp_freertos::ReadWriteLockPreferWriter:
Collaboration graph
[legend]

Public Member Functions

 ReadWriteLockPreferWriter ()
 
virtual ~ReadWriteLockPreferWriter ()
 
virtual void ReaderLock ()
 
virtual void ReaderUnlock ()
 
virtual void WriterLock ()
 
virtual void WriterUnlock ()
 
- Public Member Functions inherited from cpp_freertos::ReadWriteLock
 ReadWriteLock ()
 
virtual ~ReadWriteLock ()
 

Private Attributes

int WriteCount
 
SemaphoreHandle_t WriteLock
 
SemaphoreHandle_t BlockReadersLock
 

Additional Inherited Members

- Protected Attributes inherited from cpp_freertos::ReadWriteLock
int ReadCount
 
SemaphoreHandle_t ReadLock
 
SemaphoreHandle_t ResourceLock
 

Detailed Description

Concrete derived class that implements a Reader/Writer lock that favors the Writers. That is, with enough aggressive writers, a Reader may starve.

Definition at line 219 of file read_write_lock.hpp.

Constructor & Destructor Documentation

◆ ReadWriteLockPreferWriter()

ReadWriteLockPreferWriter::ReadWriteLockPreferWriter ( )

Our derived constructor.

Definition at line 127 of file cread_write_lock.cpp.

◆ ~ReadWriteLockPreferWriter()

ReadWriteLockPreferWriter::~ReadWriteLockPreferWriter ( )
virtual

Our derived destructor.

Definition at line 164 of file cread_write_lock.cpp.

Member Function Documentation

◆ ReaderLock()

void ReadWriteLockPreferWriter::ReaderLock ( )
virtual

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

Implements cpp_freertos::ReadWriteLock.

Definition at line 171 of file cread_write_lock.cpp.

◆ ReaderUnlock()

void ReadWriteLockPreferWriter::ReaderUnlock ( )
virtual

Unlock the Reader.

Implements cpp_freertos::ReadWriteLock.

Definition at line 186 of file cread_write_lock.cpp.

◆ WriterLock()

void ReadWriteLockPreferWriter::WriterLock ( )
virtual

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

Implements cpp_freertos::ReadWriteLock.

Definition at line 199 of file cread_write_lock.cpp.

◆ WriterUnlock()

void ReadWriteLockPreferWriter::WriterUnlock ( )
virtual

Unlock the Writer.

Implements cpp_freertos::ReadWriteLock.

Definition at line 214 of file cread_write_lock.cpp.

Member Data Documentation

◆ BlockReadersLock

SemaphoreHandle_t cpp_freertos::ReadWriteLockPreferWriter::BlockReadersLock
private

Lock to stop reader threads from starving a Writer.

Definition at line 280 of file read_write_lock.hpp.

◆ WriteCount

int cpp_freertos::ReadWriteLockPreferWriter::WriteCount
private

Number of Writers waiting for the Resource Lock, including any current Writer already holdign it.

Definition at line 270 of file read_write_lock.hpp.

◆ WriteLock

SemaphoreHandle_t cpp_freertos::ReadWriteLockPreferWriter::WriteLock
private

Protect WriteCount.

Definition at line 275 of file read_write_lock.hpp.


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