5 #include "../arch/arch.h"
9 std::atomic<unsigned int> sequence;
11 volatile unsigned int sequence;
15 static inline void seqlock_init(struct seqlock *s)
20 static inline unsigned int read_seqlock_begin(struct seqlock *s)
25 seq = atomic_load_acquire(&s->sequence);
34 static inline bool read_seqlock_retry(struct seqlock *s, unsigned int seq)
37 return s->sequence != seq;
40 static inline void write_seqlock_begin(struct seqlock *s)
42 s->sequence = atomic_load_acquire(&s->sequence) + 1;
45 static inline void write_seqlock_end(struct seqlock *s)
47 atomic_store_release(&s->sequence, s->sequence + 1);