17 #ifndef _RTEMS_SCORE_SMPLOCKSEQ_H 18 #define _RTEMS_SCORE_SMPLOCKSEQ_H 20 #include <rtems/score/cpuopts.h> 22 #if defined(RTEMS_SMP) 62 #define SMP_SEQUENCE_LOCK_INITIALIZER { ATOMIC_INITIALIZER_UINT( 0 ) } 73 _Atomic_Init_uint( &lock->
sequence, 0 );
105 seq = _Atomic_Load_uint( &lock->
sequence, ATOMIC_ORDER_RELAXED );
108 _Atomic_Store_uint( &lock->
sequence, seq + 1, ATOMIC_ORDER_RELAXED );
111 _Atomic_Fence( ATOMIC_ORDER_ACQ_REL );
127 _Atomic_Store_uint( &lock->
sequence, seq + 2, ATOMIC_ORDER_RELEASE );
143 return _Atomic_Load_uint( &lock->
sequence, ATOMIC_ORDER_ACQUIRE );
164 seq2 = _Atomic_Fetch_add_uint( &lock->
sequence, 0, ATOMIC_ORDER_RELEASE );
165 return seq != seq2 || seq % 2 != 0;
static void _SMP_sequence_lock_Initialize(SMP_sequence_lock_Control *lock)
Initializes an SMP sequence lock.
static unsigned int _SMP_sequence_lock_Write_begin(SMP_sequence_lock_Control *lock)
Begins an SMP sequence lock write operation.
Atomic_Uint sequence
The sequence number.
static unsigned int _SMP_sequence_lock_Read_begin(const SMP_sequence_lock_Control *lock)
Begins an SMP sequence lock read operation.
Information for the Assert Handler.
static void _SMP_sequence_lock_Write_end(SMP_sequence_lock_Control *lock, unsigned int seq)
Ends an SMP sequence lock write operation.
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.
SMP sequence lock control.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
static void _SMP_sequence_lock_Destroy(SMP_sequence_lock_Control *lock)
Destroys an SMP sequence lock.