diff --git a/include/ck_epoch.h b/include/ck_epoch.h index fea24e7..23215dd 100644 --- a/include/ck_epoch.h +++ b/include/ck_epoch.h @@ -103,7 +103,16 @@ ck_epoch_read_begin(ck_epoch_record_t *record) } CK_CC_INLINE static void -ck_epoch_end(ck_epoch_record_t *record) +ck_epoch_read_end(ck_epoch_record_t *record) +{ + + ck_pr_fence_store(); + ck_pr_store_uint(&record->active, record->active - 1); + return; +} + +CK_CC_INLINE static void +ck_epoch_write_end(ck_epoch_record_t *record) { ck_pr_fence_store(); diff --git a/regressions/ck_epoch/validate/ck_stack.c b/regressions/ck_epoch/validate/ck_stack.c index 64e52ee..a5b9735 100644 --- a/regressions/ck_epoch/validate/ck_stack.c +++ b/regressions/ck_epoch/validate/ck_stack.c @@ -108,11 +108,11 @@ thread(void *unused CK_CC_UNUSED) for (i = 0; i < PAIRS; i++) { ck_epoch_write_begin(&record); ck_stack_push_upmc(&stack, &entry[i]->stack_entry); - ck_epoch_end(&record); + ck_epoch_write_end(&record); ck_epoch_write_begin(&record); s = ck_stack_pop_upmc(&stack); - ck_epoch_end(&record); + ck_epoch_write_end(&record); e = stack_container(s); ck_epoch_free(&record, &e->epoch_entry, destructor); diff --git a/regressions/ck_epoch/validate/ck_stack_read.c b/regressions/ck_epoch/validate/ck_stack_read.c index 5b78cda..c6f5a6c 100644 --- a/regressions/ck_epoch/validate/ck_stack_read.c +++ b/regressions/ck_epoch/validate/ck_stack_read.c @@ -117,7 +117,7 @@ read_thread(void *unused CK_CC_UNUSED) j++; n++; } - ck_epoch_end(&record); + ck_epoch_read_end(&record); if (j != 0 && ck_pr_load_uint(&readers) == 0) ck_pr_store_uint(&readers, 1); @@ -170,7 +170,7 @@ thread(void *unused CK_CC_UNUSED) for (i = 0; i < PAIRS; i++) { ck_epoch_write_begin(&record); ck_stack_push_upmc(&stack, &entry[i]->stack_entry); - ck_epoch_end(&record); + ck_epoch_write_end(&record); } while (ck_pr_load_uint(&readers) == 0) @@ -179,7 +179,7 @@ thread(void *unused CK_CC_UNUSED) for (i = 0; i < PAIRS; i++) { ck_epoch_write_begin(&record); s = ck_stack_pop_upmc(&stack); - ck_epoch_end(&record); + ck_epoch_write_end(&record); e = stack_container(s); ck_epoch_free(&record, &e->epoch_entry, destructor);