8000 [C] suggest aeron_mpsc_rb_claim_capacity reset padding to zero · Issue #636 · aeron-io/aeron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[C] suggest aeron_mpsc_rb_claim_capacity reset padding to zero #636
Closed
@chaoyongzhou

Description

@chaoyongzhou

aeron_mpsc_rb_claim_capacity function do{}while(...) would trigger retry.
suggest reset padding to zero on start of each retry.
e.g.,

do
{
    int32_t available_capacity = 0;

    padding = 0; /*reset*/
    .......

    if (required_capacity > to_buffer_end_length)
    {
        size_t
50ED
 head_index = (int32_t)head & mask;

        if (required_capacity > head_index)
        {
            AERON_GET_VOLATILE(head, ring_buffer->descriptor->head_position);
            head_index = (int32_t)head & mask;

            if (required_capacity > head_index)
            {
                return -1;
            }

            AERON_PUT_ORDERED(ring_buffer->descriptor->head_cache_position, head);
        }

        padding = to_buffer_end_length;
    }
}
while (!aeron_cmpxchg64(
    &(ring_buffer->descriptor->tail_position),
    tail,
    tail + (int32_t)required_capacity + (int32_t)padding));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0