Skip to content

Possible error #2

@ConorWilliams

Description

@ConorWilliams

Hi there, on line 206 in steal() you have moved the ->get() call into the CAS if, (as oppose to before like Figure 1. in the reference material). I believe this introduces a bug as:

  1. Thread A executes a steal() and hangs just after successfully completing the CAS.
  2. A push occurs, from thread B, that overwrites the stolen item (due to buffer wrap around).
  3. A wakes up and retrieves the wrong item.

This could be fixed by moving the ->get() before the CAS branch but then a copy must be made for every steal, even the unsuccessful ones :(

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions