From 07050dc044cdca5a7cd51286840fb956c29a5f66 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 6 Sep 2012 12:21:27 -0400 Subject: [PATCH] ck_epoch: Short-circuit scan step if epoch was changed from underneath us. --- src/ck_epoch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ck_epoch.c b/src/ck_epoch.c index 5fdac7e..4c14e05 100644 --- a/src/ck_epoch.c +++ b/src/ck_epoch.c @@ -329,8 +329,13 @@ ck_epoch_barrier(struct ck_epoch *global, struct ck_epoch_record *record) * could exist to the snapshot of e observed at the time this * function was called. */ - while (cr = ck_epoch_scan(global, cr, delta), cr != NULL) + while (cr = ck_epoch_scan(global, cr, delta), cr != NULL) { + epoch = ck_pr_load_uint(&global->epoch); + if (epoch != delta) + break; + ck_pr_stall(); + } /* * As the synchronize operation is non-blocking, it is possible other