From 94698736c1d1eb01e10b8297f18cf20905d6034d Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Fri, 17 Aug 2012 13:29:23 -0400 Subject: [PATCH] ck_queue: Add appropriate load fences. --- include/ck_queue.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/ck_queue.h b/include/ck_queue.h index 004461d..911d5e1 100644 --- a/include/ck_queue.h +++ b/include/ck_queue.h @@ -137,17 +137,17 @@ struct { \ #define CK_SLIST_FOREACH(var, head, field) \ for ((var) = CK_SLIST_FIRST((head)); \ - (var); \ + (var) && (ck_pr_fence_load(), 1); \ (var) = CK_SLIST_NEXT((var), field)) -#define CK_SLIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = (head)->slh_first; \ - (var) && ((tvar) = (var)->field.sle_next, 1); \ +#define CK_SLIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = CK_SLIST_FIRST(head); \ + (var) && (ck_pr_fence_load(), (tvar) = CK_SLIST_NEXT(var, field), 1);\ (var) = (tvar)) #define CK_SLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &(head)->slh_first; \ - ((var) = ck_pr_load_ptr(varp)) != NULL; \ + ((var) = ck_pr_load_ptr(varp)) != NULL && (ck_pr_fence_load(), 1); \ (varp) = &(var)->field.sle_next) #define CK_SLIST_INIT(head) do { \ @@ -220,12 +220,12 @@ struct { \ #define CK_LIST_FOREACH(var, head, field) \ for ((var) = CK_LIST_FIRST((head)); \ - (var); \ + (var) && (ck_pr_fence_load(), 1); \ (var) = CK_LIST_NEXT((var), field)) -#define CK_LIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = CK_LIST_FIRST((head)); \ - (var) && ((tvar) = CK_LIST_NEXT((var), field), 1); \ +#define CK_LIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = CK_LIST_FIRST((head)); \ + (var) && (ck_pr_fence_load(), (tvar) = CK_LIST_NEXT((var), field), 1);\ (var) = (tvar)) #define CK_LIST_INIT(head) do { \