Add explicit comments about purpose of writing to pad

pull/5081/head
Vijay Pai 9 years ago
parent 07a6be99bd
commit 663a29144a
  1. 2
      src/core/support/stack_lockfree.c

@ -100,6 +100,7 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) {
/* Point the head at reserved dummy entry */ /* Point the head at reserved dummy entry */
stack->head.contents.index = INVALID_ENTRY_INDEX; stack->head.contents.index = INVALID_ENTRY_INDEX;
#ifdef GPR_ARCH_64 #ifdef GPR_ARCH_64
// Fill in the pad to avoid confusing memcheck tools
stack->head.contents.pad = 0; stack->head.contents.pad = 0;
#endif #endif
stack->head.contents.aba_ctr = 0; stack->head.contents.aba_ctr = 0;
@ -120,6 +121,7 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) {
/* First fill in the entry's index and aba ctr for new head */ /* First fill in the entry's index and aba ctr for new head */
newhead.contents.index = (uint16_t)entry; newhead.contents.index = (uint16_t)entry;
#ifdef GPR_ARCH_64 #ifdef GPR_ARCH_64
// Fill in the pad to avoid confusing memcheck tools
newhead.contents.pad = 0; newhead.contents.pad = 0;
#endif #endif

Loading…
Cancel
Save