Skip to content

use std::memory_order_relaxed for external stream metrics std::atomic counter. #488

@yokofly

Description

@yokofly

Describe what enhancement you'd like to have
we can consider to use relaxed for this pure atomic counter. counter is not related to happen before. this is sufficient.
No ordering constraints, only atomic operations.

That's to say, assume the thread A will increate counter 5 the thread B will increace counter 10.
the final result does not care about the A or B order, right?

https://stackoverflow.com/a/27716387
https://en.cppreference.com/w/cpp/atomic/memory_order#Relaxed_ordering

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions