ck_cohort: Fixed regression tests based on ck_cohort_rw changes

ck_pring
Brendon Scheinman 12 years ago
parent 77ff96b15a
commit 3fefa3b5a3

@ -60,26 +60,34 @@ static unsigned int barrier;
static int critical CK_CC_CACHELINE;
static void
ck_spinlock_lock_with_context(ck_spinlock_t *lock, void *context)
ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context)
{
(void)context;
ck_spinlock_lock(lock);
ck_spinlock_fas_lock(lock);
return;
}
static void
ck_spinlock_unlock_with_context(ck_spinlock_t *lock, void *context)
ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context)
{
(void)context;
ck_spinlock_unlock(lock);
ck_spinlock_fas_unlock(lock);
return;
}
static bool
ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context)
{
(void)context;
return ck_spinlock_fas_locked(lock);
}
CK_COHORT_PROTOTYPE(basic,
ck_spinlock_lock_with_context, ck_spinlock_unlock_with_context,
ck_spinlock_lock_with_context, ck_spinlock_unlock_with_context)
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_with_context,
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_with_context)
struct cohort_record {
CK_COHORT_INSTANCE(basic) cohort;

@ -1,24 +1,33 @@
#define LOCK_NAME "ck_cohort"
#define LOCK_DEFINE\
static ck_spinlock_fas_t global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
static ck_spinlock_fas_t local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
static void\
ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context)\
{\
(void)context;\
ck_spinlock_fas_lock(lock);\
}\
\
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_lock_with_context, ck_spinlock_fas_unlock_with_context,\
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context)\
static ck_spinlock_fas_t global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER; \
static ck_spinlock_fas_t local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER; \
static void \
ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context) \
{ \
(void)context; \
ck_spinlock_fas_lock(lock); \
} \
\
static void \
ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context) \
{ \
(void)context; \
ck_spinlock_fas_unlock(lock); \
} \
\
static bool \
ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context) \
{ \
(void)context; \
return ck_spinlock_fas_locked(lock); \
} \
CK_COHORT_PROTOTYPE(fas_fas, \
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, \
ck_spinlock_fas_locked_with_context, ck_spinlock_fas_lock_with_context, \
ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_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,\
CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT)
#define LOCK CK_COHORT_LOCK(fas_fas, &cohort, NULL, NULL)

@ -59,6 +59,13 @@ ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context)
ck_spinlock_fas_unlock(lock);
}
static bool
ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context)
{
(void)context;
return ck_spinlock_fas_locked(lock);
}
static bool
ck_spinlock_fas_trylock_with_context(ck_spinlock_fas_t *lock, void *context)
{
@ -67,8 +74,10 @@ ck_spinlock_fas_trylock_with_context(ck_spinlock_fas_t *lock, void *context)
}
CK_COHORT_TRYLOCK_PROTOTYPE(fas_fas,
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_trylock_with_context,
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_trylock_with_context)
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context,
ck_spinlock_fas_locked_with_context, ck_spinlock_fas_trylock_with_context,
ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context,
ck_spinlock_fas_locked_with_context, ck_spinlock_fas_trylock_with_context)
static CK_COHORT_INSTANCE(fas_fas) *cohorts;
static int n_cohorts;

Loading…
Cancel
Save