| 543 | } |
| 544 | |
| 545 | void * |
| 546 | ink_atomiclist_popall(InkAtomicList *l) |
| 547 | { |
| 548 | head_p item; |
| 549 | head_p next; |
| 550 | int result = 0; |
| 551 | do { |
| 552 | INK_QUEUE_LD(item, l->head); |
| 553 | if (TO_PTR(FREELIST_POINTER(item)) == nullptr) { |
| 554 | return nullptr; |
| 555 | } |
| 556 | SET_FREELIST_POINTER_VERSION(next, FROM_PTR(nullptr), FREELIST_VERSION(item) + 1); |
| 557 | result = ink_atomic_cas(&l->head.data, item.data, next.data); |
| 558 | } while (result == 0); |
| 559 | { |
| 560 | void *ret = TO_PTR(FREELIST_POINTER(item)); |
| 561 | void *e = ret; |
| 562 | /* fixup forward pointers */ |
| 563 | while (e) { |
| 564 | void *n = TO_PTR(*ADDRESS_OF_NEXT(e, l->offset)); |
| 565 | *ADDRESS_OF_NEXT(e, l->offset) = n; |
| 566 | e = n; |
| 567 | } |
| 568 | return ret; |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | void * |
| 573 | ink_atomiclist_push(InkAtomicList *l, void *item) |