37#ifndef _RTEMS_SCORE_SMPLOCKSEQ_H
38#define _RTEMS_SCORE_SMPLOCKSEQ_H
40#include <rtems/score/cpuopts.h>
77} SMP_sequence_lock_Control;
82#define SMP_SEQUENCE_LOCK_INITIALIZER { ATOMIC_INITIALIZER_UINT( 0 ) }
91static inline void _SMP_sequence_lock_Initialize( SMP_sequence_lock_Control *lock )
93 _Atomic_Init_uint( &lock->sequence, 0 );
103static inline void _SMP_sequence_lock_Destroy( SMP_sequence_lock_Control *lock )
119static inline unsigned int _SMP_sequence_lock_Write_begin(
120 SMP_sequence_lock_Control *lock
125 seq = _Atomic_Load_uint( &lock->sequence, ATOMIC_ORDER_RELAXED );
128 _Atomic_Store_uint( &lock->sequence, seq + 1, ATOMIC_ORDER_RELAXED );
131 _Atomic_Fence( ATOMIC_ORDER_ACQ_REL );
142static inline void _SMP_sequence_lock_Write_end(
143 SMP_sequence_lock_Control *lock,
147 _Atomic_Store_uint( &lock->sequence, seq + 2, ATOMIC_ORDER_RELEASE );
159static inline unsigned int _SMP_sequence_lock_Read_begin(
160 const SMP_sequence_lock_Control *lock
163 return _Atomic_Load_uint( &lock->sequence, ATOMIC_ORDER_ACQUIRE );
177static inline bool _SMP_sequence_lock_Read_retry(
178 SMP_sequence_lock_Control *lock,
184 seq2 = _Atomic_Fetch_add_uint( &lock->sequence, 0, ATOMIC_ORDER_RELEASE );
185 return seq != seq2 || seq % 2 != 0;
This header file provides the interfaces of the Assert Handler.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
This header file provides the interfaces of the Atomic Operations.