forked from KolibriOS/kolibrios
ddk: v4.5.7
git-svn-id: svn://kolibrios.org@6936 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -234,7 +234,53 @@ static inline void raw_write_seqcount_end(seqcount_t *s)
|
||||
s->sequence++;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* raw_write_seqcount_barrier - do a seq write barrier
|
||||
* @s: pointer to seqcount_t
|
||||
*
|
||||
* This can be used to provide an ordering guarantee instead of the
|
||||
* usual consistency guarantee. It is one wmb cheaper, because we can
|
||||
* collapse the two back-to-back wmb()s.
|
||||
*
|
||||
* seqcount_t seq;
|
||||
* bool X = true, Y = false;
|
||||
*
|
||||
* void read(void)
|
||||
* {
|
||||
* bool x, y;
|
||||
*
|
||||
* do {
|
||||
* int s = read_seqcount_begin(&seq);
|
||||
*
|
||||
* x = X; y = Y;
|
||||
*
|
||||
* } while (read_seqcount_retry(&seq, s));
|
||||
*
|
||||
* BUG_ON(!x && !y);
|
||||
* }
|
||||
*
|
||||
* void write(void)
|
||||
* {
|
||||
* Y = true;
|
||||
*
|
||||
* raw_write_seqcount_barrier(seq);
|
||||
*
|
||||
* X = false;
|
||||
* }
|
||||
*/
|
||||
static inline void raw_write_seqcount_barrier(seqcount_t *s)
|
||||
{
|
||||
s->sequence++;
|
||||
smp_wmb();
|
||||
s->sequence++;
|
||||
}
|
||||
|
||||
static inline int raw_read_seqcount_latch(seqcount_t *s)
|
||||
{
|
||||
return lockless_dereference(s->sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* raw_write_seqcount_latch - redirect readers to even/odd copy
|
||||
* @s: pointer to seqcount_t
|
||||
*
|
||||
|
Reference in New Issue
Block a user