From babae24a07aeee61175b8d3260eeef5f8792bfd2 Mon Sep 17 00:00:00 2001 From: Brendon Scheinman Date: Mon, 13 May 2013 18:07:57 -0400 Subject: [PATCH] ck_rwcohort: Added missing return statements and changed while (true) loops to for (;;) --- include/ck_rwcohort.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/ck_rwcohort.h b/include/ck_rwcohort.h index 2ae88bb..582b232 100644 --- a/include/ck_rwcohort.h +++ b/include/ck_rwcohort.h @@ -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 { \