ck_epoch_poll: Update writer epoch snapshot on poll.

If our CAS operation fails, we should grab a snapshot of epoch
for future ck_epoch_call invocations.
ck_pring
Samy Al Bahra 13 years ago
parent 8a9f29a354
commit 5d013028d9

@ -382,13 +382,19 @@ ck_epoch_poll(struct ck_epoch *global, struct ck_epoch_record *record)
struct ck_epoch_record *cr = NULL;
/* Serialize record epoch snapshots with respect to global epoch load. */
record->epoch = epoch;
ck_pr_fence_memory();
cr = ck_epoch_scan(global, cr, epoch);
if (cr != NULL)
if (cr != NULL) {
record->epoch = epoch;
return false;
}
if (ck_pr_cas_uint_value(&global->epoch, epoch, epoch + 1, &snapshot) == false) {
record->epoch = snapshot;
} else {
record->epoch = epoch + 1;
}
ck_pr_cas_uint_value(&global->epoch, epoch, epoch + 1, &snapshot);
ck_epoch_dispatch(record, epoch + 1);
return true;
}

Loading…
Cancel
Save