|
|
|
@ -88,6 +88,7 @@
|
|
|
|
|
{ \
|
|
|
|
|
(void)rw_cohort; \
|
|
|
|
|
CK_COHORT_UNLOCK(N, cohort, global_context, local_context); \
|
|
|
|
|
return; \
|
|
|
|
|
} \
|
|
|
|
|
CK_CC_INLINE static void \
|
|
|
|
|
ck_rwcohort_wp_##N##_read_lock(CK_RWCOHORT_WP_INSTANCE(N) *rw_cohort, \
|
|
|
|
@ -97,7 +98,7 @@
|
|
|
|
|
unsigned int wait_count = 0; \
|
|
|
|
|
bool raised = false; \
|
|
|
|
|
\
|
|
|
|
|
while (true) { \
|
|
|
|
|
for (;;) { \
|
|
|
|
|
ck_pr_inc_uint(&rw_cohort->read_counter); \
|
|
|
|
|
if (CK_COHORT_LOCKED(N, cohort, global_context, local_context) == false) {\
|
|
|
|
|
break; \
|
|
|
|
@ -123,6 +124,7 @@
|
|
|
|
|
ck_rwcohort_wp_##N##_read_unlock(CK_RWCOHORT_WP_INSTANCE(N) *cohort) \
|
|
|
|
|
{ \
|
|
|
|
|
ck_pr_dec_uint(&cohort->read_counter); \
|
|
|
|
|
return; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define CK_RWCOHORT_WP_INITIALIZER { \
|
|
|
|
@ -165,7 +167,7 @@
|
|
|
|
|
unsigned int wait_count = 0; \
|
|
|
|
|
bool raised = false; \
|
|
|
|
|
\
|
|
|
|
|
while (true) { \
|
|
|
|
|
for (;;) { \
|
|
|
|
|
CK_COHORT_LOCK(N, cohort, global_context, local_context); \
|
|
|
|
|
if (ck_pr_load_uint(&rw_cohort->read_counter) == 0) { \
|
|
|
|
|
break; \
|
|
|
|
@ -193,6 +195,7 @@
|
|
|
|
|
{ \
|
|
|
|
|
(void)rw_cohort; \
|
|
|
|
|
CK_COHORT_UNLOCK(N, cohort, global_context, local_context); \
|
|
|
|
|
return; \
|
|
|
|
|
} \
|
|
|
|
|
CK_CC_INLINE static void \
|
|
|
|
|
ck_rwcohort_rp_##N##_read_lock(CK_RWCOHORT_RP_INSTANCE(N) *rw_cohort, \
|
|
|
|
@ -214,6 +217,7 @@
|
|
|
|
|
ck_rwcohort_rp_##N##_read_unlock(CK_RWCOHORT_RP_INSTANCE(N) *cohort) \
|
|
|
|
|
{ \
|
|
|
|
|
ck_pr_dec_uint(&cohort->read_counter); \
|
|
|
|
|
return; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define CK_RWCOHORT_RP_INITIALIZER { \
|
|
|
|
@ -260,6 +264,7 @@
|
|
|
|
|
{ \
|
|
|
|
|
(void)rw_cohort; \
|
|
|
|
|
CK_COHORT_UNLOCK(N, cohort, global_context, local_context); \
|
|
|
|
|
return; \
|
|
|
|
|
} \
|
|
|
|
|
CK_CC_INLINE static void \
|
|
|
|
|
ck_rwcohort_neutral_##N##_read_lock(CK_RWCOHORT_NEUTRAL_INSTANCE(N) *rw_cohort, \
|
|
|
|
@ -276,6 +281,7 @@
|
|
|
|
|
ck_rwcohort_neutral_##N##_read_unlock(CK_RWCOHORT_NEUTRAL_INSTANCE(N) *cohort) \
|
|
|
|
|
{ \
|
|
|
|
|
ck_pr_dec_uint(&cohort->read_counter); \
|
|
|
|
|
return; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define CK_RWCOHORT_NEUTRAL_INITIALIZER { \
|
|
|
|
|