Implement test for stack initial push edge

pull/2470/head
Craig Tiller 10 years ago
parent 6a006cee8a
commit ffe27b98b9
  1. 2
      src/core/support/stack_lockfree.c
  2. 2
      test/core/support/stack_lockfree_test.c

@ -112,7 +112,7 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) {
} while (!gpr_atm_rel_cas(&(stack->head.atm),
head.atm, newhead.atm));
/* Use rel_cas above to make sure that entry index is set properly */
return head.atm == INVALID_ENTRY_INDEX;
return head.contents.index == INVALID_ENTRY_INDEX;
}
int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) {

@ -62,7 +62,7 @@ static void test_serial_sized(int size) {
for (i=1; i<size; i*=2) {
int j;
for (j=0; j<=i; j++) {
gpr_stack_lockfree_push(stack, j);
GPR_ASSERT(gpr_stack_lockfree_push(stack, j) == (j==0));
}
for (j=0; j<=i; j++) {
GPR_ASSERT(gpr_stack_lockfree_pop(stack) == i-j);

Loading…
Cancel
Save