Skip to content

Is it necessary to use cmpxchg when clear a bit of MaskAndCount? #74

@lastweek

Description

@lastweek

Hi,

Quick question about MaskAndCount.

It could be read by multiple threads concurrently, thus a final compare_and_swap is necessary to guarantee atomicity.

But is it only being cleared by one single thread (the one who owns it)? If so, it seems a simple atomic clear_bit() is enough rather than full-fledged cmpxchg. Related code here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions