parent
27d841d300
commit
803073b024
@ -1,10 +1,24 @@
|
|||||||
#define LOCK_NAME "ck_cohort"
|
#define LOCK_NAME "ck_cohort"
|
||||||
#define LOCK_DEFINE\
|
#define LOCK_DEFINE\
|
||||||
typedef ck_spinlock_fas_t ck_spinlock_fas;\
|
static ck_spinlock_fas_t global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
|
||||||
static ck_spinlock_fas global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
|
static ck_spinlock_fas_t local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
|
||||||
static ck_spinlock_fas local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
|
static void\
|
||||||
CK_COHORT_PROTOTYPE(fas_fas, ck_spinlock_fas, ck_spinlock_fas)\
|
ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context)\
|
||||||
static struct ck_cohort_fas_fas CK_CC_CACHELINE cohort = CK_COHORT_INITIALIZER
|
{\
|
||||||
#define LOCK_INIT ck_cohort_fas_fas_init(&cohort, &global_fas_lock, &local_fas_lock)
|
(void)context;\
|
||||||
#define LOCK ck_cohort_fas_fas_lock(&cohort)
|
ck_spinlock_fas_lock(lock);\
|
||||||
#define UNLOCK ck_cohort_fas_fas_unlock(&cohort)
|
}\
|
||||||
|
\
|
||||||
|
static void\
|
||||||
|
ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context)\
|
||||||
|
{\
|
||||||
|
(void)context;\
|
||||||
|
ck_spinlock_fas_unlock(lock);\
|
||||||
|
}\
|
||||||
|
CK_COHORT_PROTOTYPE(fas_fas,\
|
||||||
|
ck_spinlock_fas_t, ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context,\
|
||||||
|
ck_spinlock_fas_t, ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context)\
|
||||||
|
static CK_COHORT_INSTANCE(fas_fas) CK_CC_CACHELINE cohort = CK_COHORT_INITIALIZER
|
||||||
|
#define LOCK_INIT CK_COHORT_INIT(fas_fas, &cohort, &global_fas_lock, &local_fas_lock)
|
||||||
|
#define LOCK CK_COHORT_LOCK(fas_fas, &cohort, NULL, NULL)
|
||||||
|
#define UNLOCK CK_COHORT_UNLOCK(fas_fas, &cohort, NULL, NULL)
|
||||||
|
Loading…
Reference in new issue