Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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