RTEMS
|
The SMP lock provides mutual exclusion for SMP systems at the lowest level. More...
Files | |
file | smplock.h |
SMP Lock API. | |
file | smplockmcs.h |
SMP Lock API. | |
file | smplockseq.h |
SMP Lock API. | |
file | smplockstats.h |
SMP Lock API. | |
file | smplockticket.h |
SMP Lock API. | |
Classes | |
struct | SMP_lock_Control |
SMP lock control. More... | |
struct | SMP_lock_Context |
Local SMP lock context for acquire and release pairs. More... | |
struct | SMP_MCS_lock_Context |
SMP Mellor-Crummey and Scott (MCS) lock context. More... | |
struct | SMP_MCS_lock_Control |
SMP Mellor-Crummey and Scott (MCS) lock control. More... | |
struct | SMP_sequence_lock_Control |
SMP sequence lock control. More... | |
struct | SMP_ticket_lock_Control |
SMP ticket lock control. More... | |
Macros | |
#define | SMP_LOCK_INITIALIZER(name) { SMP_TICKET_LOCK_INITIALIZER } |
SMP lock control initializer for static initialization. | |
#define | _SMP_lock_Initialize(lock, name) _SMP_lock_Initialize_inline( lock, name ) |
Initializes an SMP lock. More... | |
#define | _SMP_lock_Destroy(lock) _SMP_lock_Destroy_inline( lock ) |
Destroys an SMP lock. More... | |
#define | _SMP_lock_Release(lock, context) _SMP_lock_Release_inline( lock, context ) |
Releases an SMP lock. More... | |
#define | _SMP_lock_Release_and_ISR_enable(lock, context) _SMP_lock_Release_and_ISR_enable_inline( lock, context ) |
Releases the SMP lock and enables interrupts. More... | |
#define | SMP_MCS_LOCK_INITIALIZER { { ATOMIC_INITIALIZER_UINTPTR( 0 ) } } |
SMP MCS lock control initializer for static initialization. | |
#define | _SMP_MCS_lock_Acquire(lock, context, stats) _SMP_MCS_lock_Do_acquire( lock, context ) |
Acquires an SMP MCS lock. More... | |
#define | SMP_SEQUENCE_LOCK_INITIALIZER { ATOMIC_INITIALIZER_UINT( 0 ) } |
SMP sequence lock control initializer for static initialization. | |
#define | _SMP_lock_Stats_initialize(stats, name) do { } while ( 0 ) |
#define | _SMP_lock_Stats_destroy(stats) do { } while ( 0 ) |
#define | SMP_TICKET_LOCK_INITIALIZER |
SMP ticket lock control initializer for static initialization. More... | |
#define | _SMP_ticket_lock_Acquire(lock, stats, stats_context) _SMP_ticket_lock_Do_acquire( lock ) |
Acquires an SMP ticket lock. More... | |
#define | _SMP_ticket_lock_Release(lock, stats_context) _SMP_ticket_lock_Do_release( lock ) |
Releases an SMP ticket lock. More... | |
Typedefs | |
typedef struct SMP_MCS_lock_Context | SMP_MCS_lock_Context |
SMP Mellor-Crummey and Scott (MCS) lock context. | |
Functions | |
static void | _SMP_lock_Initialize_inline (SMP_lock_Control *lock, const char *name) |
Initializes the SMP lock with the given name. More... | |
static void | _SMP_lock_Destroy_inline (SMP_lock_Control *lock) |
Destroys the SMP lock. More... | |
static void | _SMP_lock_Set_name (SMP_lock_Control *lock, const char *name) |
Sets the name of an SMP lock. More... | |
static void | _SMP_lock_Acquire_inline (SMP_lock_Control *lock, SMP_lock_Context *context) |
Gets my index. More... | |
void | _SMP_lock_Acquire (SMP_lock_Control *lock, SMP_lock_Context *context) |
Acquires an SMP lock. More... | |
static void | _SMP_lock_Release_inline (SMP_lock_Control *lock, SMP_lock_Context *context) |
Releases an SMP lock. More... | |
static void | _SMP_lock_ISR_disable_and_acquire_inline (SMP_lock_Control *lock, SMP_lock_Context *context) |
Disables interrupts and acquires the SMP lock. More... | |
void | _SMP_lock_ISR_disable_and_acquire (SMP_lock_Control *lock, SMP_lock_Context *context) |
Disables interrupts and acquires the SMP lock. More... | |
static void | _SMP_lock_Release_and_ISR_enable_inline (SMP_lock_Control *lock, SMP_lock_Context *context) |
Releases the SMP lock and enables interrupts. More... | |
static void | _SMP_MCS_lock_Initialize (SMP_MCS_lock_Control *lock) |
Initializes the SMP MCS lock. More... | |
static void | _SMP_MCS_lock_Destroy (SMP_MCS_lock_Control *lock) |
Destroys the SMP MCS lock. More... | |
static void | _SMP_MCS_lock_Do_acquire (SMP_MCS_lock_Control *lock, SMP_MCS_lock_Context *context) |
Acquires the SMP MCS lock. More... | |
static void | _SMP_MCS_lock_Release (SMP_MCS_lock_Control *lock, SMP_MCS_lock_Context *context) |
Releases an SMP MCS lock. More... | |
static void | _SMP_sequence_lock_Initialize (SMP_sequence_lock_Control *lock) |
Initializes an SMP sequence lock. More... | |
static void | _SMP_sequence_lock_Destroy (SMP_sequence_lock_Control *lock) |
Destroys an SMP sequence lock. More... | |
static unsigned int | _SMP_sequence_lock_Write_begin (SMP_sequence_lock_Control *lock) |
Begins an SMP sequence lock write operation. More... | |
static void | _SMP_sequence_lock_Write_end (SMP_sequence_lock_Control *lock, unsigned int seq) |
Ends an SMP sequence lock write operation. More... | |
static unsigned int | _SMP_sequence_lock_Read_begin (const SMP_sequence_lock_Control *lock) |
Begins an SMP sequence lock read operation. More... | |
static bool | _SMP_sequence_lock_Read_retry (SMP_sequence_lock_Control *lock, unsigned int seq) |
Ends an SMP sequence lock read operation and indicates if a retry is necessary. More... | |
static void | _SMP_ticket_lock_Initialize (SMP_ticket_lock_Control *lock) |
Initializes the SMP ticket lock. More... | |
static void | _SMP_ticket_lock_Destroy (SMP_ticket_lock_Control *lock) |
Destroys the SMP ticket lock. More... | |
static void | _SMP_ticket_lock_Do_acquire (SMP_ticket_lock_Control *lock) |
Acquires the SMP ticket lock. More... | |
static void | _SMP_ticket_lock_Do_release (SMP_ticket_lock_Control *lock) |
Releases the SMP ticket lock. More... | |
The SMP lock provides mutual exclusion for SMP systems at the lowest level.
The SMP lock is implemented as a ticket lock. This provides fairness in case of concurrent lock attempts.
This SMP lock API uses a local context for acquire and release pairs. Such a context may be used to implement for example the Mellor-Crummey and Scott (MCS) locks in the future.
#define _SMP_lock_Destroy | ( | lock | ) | _SMP_lock_Destroy_inline( lock ) |
#define _SMP_lock_Initialize | ( | lock, | |
name | |||
) | _SMP_lock_Initialize_inline( lock, name ) |
#define _SMP_lock_Release | ( | lock, | |
context | |||
) | _SMP_lock_Release_inline( lock, context ) |
#define _SMP_lock_Release_and_ISR_enable | ( | lock, | |
context | |||
) | _SMP_lock_Release_and_ISR_enable_inline( lock, context ) |
#define _SMP_MCS_lock_Acquire | ( | lock, | |
context, | |||
stats | |||
) | _SMP_MCS_lock_Do_acquire( lock, context ) |
Acquires an SMP MCS lock.
This function will not disable interrupts. The caller must ensure that the current thread of execution is not interrupted indefinite once it obtained the SMP MCS lock.
lock | The SMP MCS lock control. |
context | The SMP MCS lock context. |
stats | The SMP lock statistics. |
Definition at line 202 of file smplockmcs.h.
#define _SMP_ticket_lock_Acquire | ( | lock, | |
stats, | |||
stats_context | |||
) | _SMP_ticket_lock_Do_acquire( lock ) |
Acquires an SMP ticket lock.
This function will not disable interrupts. The caller must ensure that the current thread of execution is not interrupted indefinite once it obtained the SMP ticket lock.
[in] | lock | The SMP ticket lock control. |
[in] | stats | The SMP lock statistics. |
[out] | stats_context | The SMP lock statistics context. |
Definition at line 149 of file smplockticket.h.
#define _SMP_ticket_lock_Release | ( | lock, | |
stats_context | |||
) | _SMP_ticket_lock_Do_release( lock ) |
Releases an SMP ticket lock.
[in] | lock | The SMP ticket lock control. |
[in] | stats_context | The SMP lock statistics context. |
Definition at line 188 of file smplockticket.h.
#define SMP_TICKET_LOCK_INITIALIZER |
SMP ticket lock control initializer for static initialization.
Definition at line 48 of file smplockticket.h.
void _SMP_lock_Acquire | ( | SMP_lock_Control * | lock, |
SMP_lock_Context * | context | ||
) |
Acquires an SMP lock.
This function will not disable interrupts. The caller must ensure that the current thread of execution is not interrupted indefinite once it obtained the SMP lock.
[in,out] | lock | The SMP lock control. |
[in,out] | context | The local SMP lock context for an acquire and release pair. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void _SMP_lock_ISR_disable_and_acquire | ( | SMP_lock_Control * | lock, |
SMP_lock_Context * | context | ||
) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Destroys the SMP MCS lock.
Concurrent destruction leads to unpredictable results.
[out] | lock | The SMP MCS lock control. |
Definition at line 125 of file smplockmcs.h.
|
inlinestatic |
Acquires the SMP MCS lock.
[in,out] | lock | The lock to acquire. |
[in,out] | context | The lock context. |
stats | the SMP lock statistics. |
Definition at line 137 of file smplockmcs.h.
|
inlinestatic |
Initializes the SMP MCS lock.
Concurrent initialization leads to unpredictable results.
[in,out] | lock | The SMP MCS lock control. |
Definition at line 113 of file smplockmcs.h.
|
inlinestatic |
Releases an SMP MCS lock.
[in,out] | lock | The SMP MCS lock control. |
[in,out] | context | The SMP MCS lock context. |
Definition at line 212 of file smplockmcs.h.
|
inlinestatic |
Destroys an SMP sequence lock.
Concurrent destruction leads to unpredictable results.
lock | The SMP sequence lock control. |
Definition at line 83 of file smplockseq.h.
|
inlinestatic |
Initializes an SMP sequence lock.
Concurrent initialization leads to unpredictable results.
[out] | lock | The SMP sequence lock control. |
Definition at line 71 of file smplockseq.h.
|
inlinestatic |
Begins an SMP sequence lock read operation.
This function will not disable interrupts.
[out] | lock | The SMP sequence lock control. |
Definition at line 139 of file smplockseq.h.
|
inlinestatic |
Ends an SMP sequence lock read operation and indicates if a retry is necessary.
[in,out] | lock | The SMP sequence lock control. |
seq | The sequence number returned by _SMP_sequence_lock_Read_begin(). |
true | The read operation must be retried with a call to _SMP_sequence_lock_Read_begin(). |
false | The read operation need not be retried. |
Definition at line 157 of file smplockseq.h.
|
inlinestatic |
Begins an SMP sequence lock write operation.
This function will not disable interrupts. The caller must ensure that the current thread of execution is not interrupted indefinite since this would starve readers.
[out] | lock | The SMP sequence lock control. |
Definition at line 99 of file smplockseq.h.
|
inlinestatic |
Ends an SMP sequence lock write operation.
[out] | lock | The SMP sequence lock control. |
seq | The sequence number returned by _SMP_sequence_lock_Write_begin(). |
Definition at line 122 of file smplockseq.h.
|
inlinestatic |
Destroys the SMP ticket lock.
Concurrent destruction leads to unpredictable results.
lock | The SMP ticket lock control. |
Definition at line 76 of file smplockticket.h.
|
inlinestatic |
Acquires the SMP ticket lock.
[in,out] | lock | The lock to acquire. |
stats | The SMP lock statistics. | |
[out] | stats_context | The context for the statistics. |
Definition at line 88 of file smplockticket.h.
|
inlinestatic |
Releases the SMP ticket lock.
[in,out] | lock | The SMP ticket lock to release. |
[out] | stats_context | The SMP lock statistics context. |
Definition at line 159 of file smplockticket.h.
|
inlinestatic |
Initializes the SMP ticket lock.
Concurrent initialization leads to unpredictable results.
[in,out] | lock | The SMP ticket lock control. |
Definition at line 61 of file smplockticket.h.