Skip to content

Update me->tail with a single assignment operation #5

@armarpc

Description

@armarpc

In the original code, me->tail is updated through a sum and then a modulo operation. This creates a race condition if another thread reads the value of tail at the same time (for instance in the usedspace function). So doing the assignment in a single instruction should be safer. It's no guarantee though, so using atomic primitives would be safer.

I created pull request #4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions