From ec2d225324929e4096122eca4ec84bcebcc75bee Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sat, 8 Apr 2017 15:10:54 -0400 Subject: [PATCH] ck_epoch: add barrier_wait operation. --- include/ck_epoch.h | 6 ++++++ src/ck_epoch.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/ck_epoch.h b/include/ck_epoch.h index 4ecbaf9..d40a1ed 100644 --- a/include/ck_epoch.h +++ b/include/ck_epoch.h @@ -258,6 +258,12 @@ bool ck_epoch_poll(ck_epoch_record_t *); void ck_epoch_synchronize(ck_epoch_record_t *); void ck_epoch_synchronize_wait(ck_epoch_t *, ck_epoch_wait_cb_t *, void *); void ck_epoch_barrier(ck_epoch_record_t *); +void ck_epoch_barrier_wait(ck_epoch_record_t *, ck_epoch_wait_cb_t *, void *); + +/* + * Reclaim entries associated with a record. This is safe to call only on + * the caller's record or records that are using call_strict. + */ void ck_epoch_reclaim(ck_epoch_record_t *); #endif /* CK_EPOCH_H */ diff --git a/src/ck_epoch.c b/src/ck_epoch.c index 0a26800..66cbb0c 100644 --- a/src/ck_epoch.c +++ b/src/ck_epoch.c @@ -531,6 +531,16 @@ ck_epoch_barrier(struct ck_epoch_record *record) return; } +void +ck_epoch_barrier_wait(struct ck_epoch_record *record, ck_epoch_wait_cb_t *cb, + void *ct) +{ + + ck_epoch_synchronize_wait(record->global, cb, ct); + ck_epoch_reclaim(record); + return; +} + /* * It may be worth it to actually apply these deferral semantics to an epoch * that was observed at ck_epoch_call time. The problem is that the latter