aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/gpr
diff options
context:
space:
mode:
authorGravatar Soheil Hassas Yeganeh <soheil@google.com>2018-10-19 14:23:04 -0400
committerGravatar Soheil Hassas Yeganeh <soheil@google.com>2018-10-19 14:23:04 -0400
commit58a85ffc5e33b2867280906605d94dfcb3c888b5 (patch)
tree0ff1808aee93efdedf856c810931dc549f6b4930 /src/core/lib/gpr
parent1f85f6ba33af282530e28c8e6a7dbaae0da8faed (diff)
Use union to make alignement robust.
Suggested-by: vjpai@google.com
Diffstat (limited to 'src/core/lib/gpr')
-rw-r--r--src/core/lib/gpr/mpscq.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/lib/gpr/mpscq.h b/src/core/lib/gpr/mpscq.h
index dac2801b4e..5ded2522bd 100644
--- a/src/core/lib/gpr/mpscq.h
+++ b/src/core/lib/gpr/mpscq.h
@@ -38,9 +38,11 @@ typedef struct gpr_mpscq_node {
// Actual queue type
typedef struct gpr_mpscq {
- gpr_atm head;
// make sure head & tail don't share a cacheline
- char padding[GPR_CACHELINE_SIZE - sizeof(head)];
+ union {
+ char padding[GPR_CACHELINE_SIZE];
+ gpr_atm head;
+ };
gpr_mpscq_node* tail;
gpr_mpscq_node stub;
} gpr_mpscq;