RTEMS CPU Kit with SuperCore  4.11.3
Files | Data Structures | Macros | Typedefs | Enumerations | Functions
RWLock Handler

This handler encapsulates functionality which provides the foundation RWLock services used in all of the APIs supported by RTEMS. More...

Collaboration diagram for RWLock Handler:

Files

file  corerwlock.c
 
file  corerwlockobtainread.c
 Obtain RWLock for reading.
 
file  corerwlockobtainwrite.c
 RWLock Obtain for Writing.
 
file  corerwlockrelease.c
 Releases the RWLock.
 

Data Structures

struct  CORE_RWLock_Attributes
 The following defines the control block used to manage the attributes of each RWLock. More...
 
struct  CORE_RWLock_Control
 The following defines the control block used to manage each RWLock. More...
 

Macros

#define CORE_RWLOCK_STATUS_LAST   CORE_RWLOCK_TIMEOUT
 This is the last status value.
 
#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.
 
#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.
 
#define _CORE_RWLock_Flush(_the_rwlock, _remote_extract_callout, _status)
 This routine assists in the deletion of a RWLock by flushing the associated wait queue. More...
 

Typedefs

typedef void(* CORE_RWLock_API_mp_support_callout) (Thread_Control *, Objects_Id)
 The following type defines the callout which the API provides to support global/multiprocessor operations on RWLocks.
 

Enumerations

enum  CORE_RWLock_States { CORE_RWLOCK_UNLOCKED, CORE_RWLOCK_LOCKED_FOR_READING, CORE_RWLOCK_LOCKED_FOR_WRITING }
 RWLock State. More...
 
enum  CORE_RWLock_Status { CORE_RWLOCK_SUCCESSFUL, CORE_RWLOCK_WAS_DELETED, CORE_RWLOCK_UNAVAILABLE, CORE_RWLOCK_TIMEOUT }
 Core RWLock handler return statuses. More...
 

Functions

void _CORE_RWLock_Initialize (CORE_RWLock_Control *the_rwlock, CORE_RWLock_Attributes *the_rwlock_attributes)
 Initialize a RWlock. More...
 
RTEMS_INLINE_ROUTINE void _CORE_RWLock_Destroy (CORE_RWLock_Control *the_rwlock)
 
void _CORE_RWLock_Obtain_for_reading (CORE_RWLock_Control *the_rwlock, Thread_Control *executing, Objects_Id id, bool wait, Watchdog_Interval timeout, CORE_RWLock_API_mp_support_callout api_rwlock_mp_support)
 Obtain RWLock for reading. More...
 
void _CORE_RWLock_Obtain_for_writing (CORE_RWLock_Control *the_rwlock, Thread_Control *executing, Objects_Id id, bool wait, Watchdog_Interval timeout, CORE_RWLock_API_mp_support_callout api_rwlock_mp_support)
 Obtain RWLock for writing. More...
 
CORE_RWLock_Status _CORE_RWLock_Release (CORE_RWLock_Control *the_rwlock, Thread_Control *executing)
 Release the RWLock. More...
 
RTEMS_INLINE_ROUTINE void _CORE_RWLock_Initialize_attributes (CORE_RWLock_Attributes *the_attributes)
 This method is used to initialize core rwlock attributes. More...
 

Detailed Description

This handler encapsulates functionality which provides the foundation RWLock services used in all of the APIs supported by RTEMS.

Macro Definition Documentation

◆ _CORE_RWLock_Flush

#define _CORE_RWLock_Flush (   _the_rwlock,
  _remote_extract_callout,
  _status 
)
Value:
&((_the_rwlock)->Wait_queue), \
(_remote_extract_callout), \
(_status) \
)
void _Thread_queue_Flush(Thread_queue_Control *the_thread_queue, Thread_queue_Flush_callout remote_extract_callout, uint32_t status)
Unblocks all threads blocked on the_thread_queue.
Definition: threadqflush.c:24

This routine assists in the deletion of a RWLock by flushing the associated wait queue.

Parameters
[in]_the_rwlockis the RWLock to flush
[in]_remote_extract_calloutis the routine to invoke if the thread unblocked is remote
[in]_statusis the status to be returned to the unblocked thread

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.

◆ CORE_RWLock_Status

Core RWLock handler return statuses.

Enumerator
CORE_RWLOCK_SUCCESSFUL 

This status indicates that the operation completed successfully.

CORE_RWLOCK_WAS_DELETED 

This status indicates that the thread was blocked waiting for an.

CORE_RWLOCK_UNAVAILABLE 

This status indicates that the rwlock was not immediately available.

CORE_RWLOCK_TIMEOUT 

This status indicates that the calling task was willing to block but the operation was unable to complete within the time allotted because the resource never became available.

Function Documentation

◆ _CORE_RWLock_Initialize()

void _CORE_RWLock_Initialize ( CORE_RWLock_Control the_rwlock,
CORE_RWLock_Attributes the_rwlock_attributes 
)

Initialize a RWlock.

This routine initializes the RWLock based on the parameters passed.

Parameters
[in]the_rwlockis the RWLock to initialize
[in]the_rwlock_attributesdefine the behavior of this instance

References _Thread_queue_Initialize(), CORE_RWLock_Control::Attributes, CORE_RWLOCK_UNLOCKED, CORE_RWLock_Control::current_state, CORE_RWLock_Control::number_of_readers, and CORE_RWLock_Control::Wait_queue.

◆ _CORE_RWLock_Initialize_attributes()

RTEMS_INLINE_ROUTINE void _CORE_RWLock_Initialize_attributes ( CORE_RWLock_Attributes the_attributes)

This method is used to initialize core rwlock attributes.

Parameters
[in]the_attributespointer to the attributes to initialize.

References CORE_RWLock_Attributes::XXX.

◆ _CORE_RWLock_Obtain_for_reading()

void _CORE_RWLock_Obtain_for_reading ( CORE_RWLock_Control the_rwlock,
Thread_Control executing,
Objects_Id  id,
bool  wait,
Watchdog_Interval  timeout,
CORE_RWLock_API_mp_support_callout  api_rwlock_mp_support 
)

Obtain RWLock for reading.

This routine attempts to obtain the RWLock for read access.

Parameters
[in]the_rwlockis the RWLock to wait for
[in]idis the id of the object being waited upon
[in]waitis true if the calling thread is willing to wait
[in]timeoutis the number of ticks the calling thread is willing to wait if wait is true.
[in]api_rwlock_mp_supportis the routine to invoke if the thread unblocked is remote
Note
Status is returned via the thread control block.

◆ _CORE_RWLock_Obtain_for_writing()

void _CORE_RWLock_Obtain_for_writing ( CORE_RWLock_Control the_rwlock,
Thread_Control executing,
Objects_Id  id,
bool  wait,
Watchdog_Interval  timeout,
CORE_RWLock_API_mp_support_callout  api_rwlock_mp_support 
)

Obtain RWLock for writing.

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

Parameters
[in]the_rwlockis the RWLock to wait for
[in]idis the id of the object being waited upon
[in]waitis true if the calling thread is willing to wait
[in]timeoutis the number of ticks the calling thread is willing to wait if wait is true.
[in]api_rwlock_mp_supportis the routine to invoke if the thread unblocked is remote
Note
Status is returned via the thread control block.

◆ _CORE_RWLock_Release()

CORE_RWLock_Status _CORE_RWLock_Release ( CORE_RWLock_Control the_rwlock,
Thread_Control executing 
)

Release the RWLock.

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

Parameters
[in]the_rwlockis the RWLock to surrender
Return values
Statusis returned to indicate successful or failure.