RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Enumerations | Functions
Read-Write Lock

This group contains the Read-Write Lock implementation. More...

Files

file  corerwlockimpl.h
 This header file provides interfaces of the Read-Write Lock which are only used by the implementation.
 
file  corerwlock.c
 This source file contains the implementation of _CORE_RWLock_Initialize().
 
file  corerwlockobtainread.c
 This source file contains the implementation of _CORE_RWLock_Seize_for_reading().
 
file  corerwlockobtainwrite.c
 This source file contains the implementation of _CORE_RWLock_Seize_for_writing().
 
file  corerwlockrelease.c
 This source file contains the implementation of _CORE_RWLock_Surrender().
 

Data Structures

struct  CORE_RWLock_Control
 

Macros

#define CORE_RWLOCK_TQ_OPERATIONS   &_Thread_queue_Operations_FIFO
 
#define CORE_RWLOCK_THREAD_WAITING_FOR_READ   0
 
#define CORE_RWLOCK_THREAD_WAITING_FOR_WRITE   1
 

Enumerations

enum  CORE_RWLock_States { CORE_RWLOCK_UNLOCKED , CORE_RWLOCK_LOCKED_FOR_READING , CORE_RWLOCK_LOCKED_FOR_WRITING }
 

Functions

void _CORE_RWLock_Initialize (CORE_RWLock_Control *the_rwlock)
 Initializes a RWlock.
 
Status_Control _CORE_RWLock_Seize_for_reading (CORE_RWLock_Control *the_rwlock, bool wait, Thread_queue_Context *queue_context)
 Obtains RWLock for reading.
 
Status_Control _CORE_RWLock_Seize_for_writing (CORE_RWLock_Control *the_rwlock, bool wait, Thread_queue_Context *queue_context)
 Obtains RWLock for writing.
 
Status_Control _CORE_RWLock_Surrender (CORE_RWLock_Control *the_rwlock)
 Releases the RWLock.
 

Detailed Description

This group contains the Read-Write Lock implementation.

Macro Definition Documentation

◆ CORE_RWLOCK_THREAD_WAITING_FOR_READ

#define CORE_RWLOCK_THREAD_WAITING_FOR_READ   0

This is used to denote that a thread is blocking waiting for read-only access to the RWLock.

◆ CORE_RWLOCK_THREAD_WAITING_FOR_WRITE

#define CORE_RWLOCK_THREAD_WAITING_FOR_WRITE   1

This is used to denote that a thread is blocking waiting for write-exclusive access to the RWLock.

Enumeration Type Documentation

◆ CORE_RWLock_States

RWLock State.

Enumerator
CORE_RWLOCK_UNLOCKED 

This indicates the the RWLock is not currently locked.

CORE_RWLOCK_LOCKED_FOR_READING 

This indicates the the RWLock is currently locked for reading.

CORE_RWLOCK_LOCKED_FOR_WRITING 

This indicates the the RWLock is currently locked for reading.

Function Documentation

◆ _CORE_RWLock_Initialize()

void _CORE_RWLock_Initialize ( CORE_RWLock_Control the_rwlock)

Initializes a RWlock.

This routine initializes the RWLock.

Parameters
[out]the_rwlockis the RWLock to initialize.

◆ _CORE_RWLock_Seize_for_reading()

Status_Control _CORE_RWLock_Seize_for_reading ( CORE_RWLock_Control the_rwlock,
bool  wait,
Thread_queue_Context queue_context 
)

Obtains RWLock for reading.

This routine attempts to obtain the RWLock for read access.

Parameters
[in,out]the_rwlockis the RWLock to wait for
waitIndicates whether the calling thread is willing to wait.
queue_contextThe thread queue context.
Return values
STATUS_SUCCESSFULThe RWlock was successfully seized.
STATUS_UNAVAILABLEThe RWlock is currently locked for writing and the calling thread is not willing to wait.
STATUS_TIMEOUTA timeout occurred.

◆ _CORE_RWLock_Seize_for_writing()

Status_Control _CORE_RWLock_Seize_for_writing ( CORE_RWLock_Control the_rwlock,
bool  wait,
Thread_queue_Context queue_context 
)

Obtains RWLock for writing.

This routine attempts to obtain the RWLock for write exclusive access.

Parameters
[in,out]the_rwlockThe RWLock to wait for.
waitIndicates whether the calling thread is willing to wait.
queue_contextThe thread queue context.
Return values
STATUS_SUCCESSFULThe RWLock was successfully obtained for write exclusive access.
STATUS_UNAVAILABLEThe RWlock is currently locked and the calling thread is not willing to wait.
STATUS_TIMEOUTA timeout occurred.

◆ _CORE_RWLock_Surrender()

Status_Control _CORE_RWLock_Surrender ( CORE_RWLock_Control the_rwlock)

Releases the RWLock.

This routine manually releases the_rwlock. All of the threads waiting for the RWLock will be readied.

Parameters
[in,out]the_rwlockThe RWLock to surrender.
Returns
STATUS_SUCCESSFUL This method is always successful.