Skip to content

in listing_7.12.cpp in pop() #57

@FallWoods

Description

@FallWoods

"If two threads execute the pop() function one after another, and thread 1 finishes executing increase_head_count() first, resulting in its
old_head's external_count=2; immediately followed by thread 2 executing increase_head_count(), leading to its old_head's external_count=3, and the stack's head's external_count=3 as well. At this point, when thread 1 executes head.compare_exchange_strong(), it will fail. Is this an error?"

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