Skip to content

Possible race condition in SpinLock #2

Open
@mgodave

Description

@mgodave

I believe there is a possible race condition in the SpinLock class. The following serialization shows the issue:

count: 0, writer: true

R1 writer.get => true
W1 writer.set(false)
R1 writer.get => false
W2 writer.set(true)
W2 count.get => 0
W2 enters critical section
R1 count.incrementAndGet => 1
R1 enters critical section

It looks like it is possible for a reader and a writer to be in the critical section at the same time.

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