File ck-fix-j1.patch of Package ck
https://github.com/concurrencykit/ck/issues/141
From fd55609ca74c610285abe519babdf71f5a31e195 Mon Sep 17 00:00:00 2001
From: Olivier Houchard <ohouchard@haproxy.com>
Date: Mon, 17 Jun 2019 14:05:05 +0200
Subject: [PATCH] regression/ck_spinlock: Make sure CORES is at least 2 for
ck_hclh.
In ck_hclh, make sure CORES is at least 2, as we then attempt to create
CORES / 2 locks.
This fixes the test when compiling with -DCORES=1.
---
regressions/ck_spinlock/ck_hclh.h | 5 +++++
1 file changed, 5 insertions(+)
Index: ck-0.6.0/regressions/ck_spinlock/ck_hclh.h
===================================================================
--- ck-0.6.0.orig/regressions/ck_spinlock/ck_hclh.h
+++ ck-0.6.0/regressions/ck_spinlock/ck_hclh.h
@@ -2,6 +2,11 @@
#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_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)