From fa63a9517403f74d89f874744f889c5478d5d607 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 17 Jun 2019 14:23:58 +0200 Subject: [PATCH] regression/ck_spinlock: Move the redefine of CORES before its first usage. Redefine CORES to 2 if it was < 2 before its first usage in LOCK_DEFINE. While harmless, it is confusing. --- regressions/ck_spinlock/ck_hclh.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/regressions/ck_spinlock/ck_hclh.h b/regressions/ck_spinlock/ck_hclh.h index b473605..1dfddbd 100644 --- a/regressions/ck_spinlock/ck_hclh.h +++ b/regressions/ck_spinlock/ck_hclh.h @@ -1,12 +1,14 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) -#define LOCK_NAME "ck_clh" -#define LOCK_DEFINE static ck_spinlock_hclh_t CK_CC_CACHELINE *glob_lock; \ - static ck_spinlock_hclh_t CK_CC_CACHELINE *local_lock[CORES / 2] + #if CORES < 2 #undef CORES #define CORES 2 #endif +#define LOCK_NAME "ck_clh" +#define LOCK_DEFINE static ck_spinlock_hclh_t CK_CC_CACHELINE *glob_lock; \ + static ck_spinlock_hclh_t CK_CC_CACHELINE *local_lock[CORES / 2] + #define LOCK_STATE ck_spinlock_hclh_t *na = malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)) #define LOCK ck_spinlock_hclh_lock(&glob_lock, &local_lock[(core % CORES) / 2], na) #define UNLOCK ck_spinlock_hclh_unlock(&na)