ck_epoch: Update epoch on read.

It's safe to update thread epoch on entry to a read-side section.
Without this, it will be very easy to starve writers of reclamation.
ck_pring
Samy Al Bahra 14 years ago
parent cbe38a9999
commit 70860736f6

@ -243,7 +243,9 @@ ck_epoch_write_begin(struct ck_epoch_record *record)
CK_CC_INLINE static void CK_CC_INLINE static void
ck_epoch_read_begin(struct ck_epoch_record *record) ck_epoch_read_begin(struct ck_epoch_record *record)
{ {
unsigned int g_epoch = ck_pr_load_uint(&global->epoch) & (CK_EPOCH_LENGTH - 1);
ck_pr_store_uint(&record->epoch, g_epoch);
ck_pr_store_uint(&record->active, 1); ck_pr_store_uint(&record->active, 1);
ck_pr_fence_store(); ck_pr_fence_store();
return; return;

Loading…
Cancel
Save