[whitespace] ck_ring: style conformance.

ck_pring
Samy Al Bahra 8 years ago
parent 316e283e16
commit 4a8957f727

@ -178,43 +178,40 @@ _ck_ring_enqueue_mp(struct ck_ring *ring,
for (;;) { for (;;) {
/* /*
* The snapshot of producer must be up to date with * The snapshot of producer must be up to date with respect to
* respect to consumer. * consumer.
*/ */
ck_pr_fence_load(); ck_pr_fence_load();
consumer = ck_pr_load_uint(&ring->c_head); consumer = ck_pr_load_uint(&ring->c_head);
delta = producer + 1; delta = producer + 1;
/* /*
* Only try to CAS if the producer is not clearly * Only try to CAS if the producer is not clearly stale (not
* stale (not less than consumer) and the buffer is * less than consumer) and the buffer is definitely not full.
* definitely not full.
*/ */
if (CK_CC_LIKELY((producer - consumer) < mask)) { if (CK_CC_LIKELY((producer - consumer) < mask)) {
if (ck_pr_cas_uint_value(&ring->p_head, if (ck_pr_cas_uint_value(&ring->p_head,
producer, producer, delta, &producer) == true) {
delta,
&producer)) {
break; break;
} }
} else { } else {
unsigned int new_producer; unsigned int new_producer;
/* /*
* Slow path. Either the buffer is full or we * Slow path. Either the buffer is full or we have a
* have a stale snapshot of p_head. Execute a * stale snapshot of p_head. Execute a second read of
* second read of p_read that must be ordered * p_read that must be ordered wrt the snapshot of
* wrt the snapshot of c_head. * c_head.
*/ */
ck_pr_fence_load(); ck_pr_fence_load();
new_producer = ck_pr_load_uint(&ring->p_head); new_producer = ck_pr_load_uint(&ring->p_head);
/* /*
* Only fail if we haven't made forward * Only fail if we haven't made forward progress in
* progress in production: the buffer must * production: the buffer must have been full when we
* have been full when we read new_producer * read new_producer (or we wrapped around UINT_MAX
* (or we wrapped around UINT_MAX during this * during this iteration).
* iteration).
*/ */
if (producer == new_producer) { if (producer == new_producer) {
r = false; r = false;
@ -222,8 +219,7 @@ _ck_ring_enqueue_mp(struct ck_ring *ring,
} }
/* /*
* p_head advanced during this iteration. Try * p_head advanced during this iteration. Try again.
* again.
*/ */
producer = new_producer; producer = new_producer;
} }

Loading…
Cancel
Save