[Issue 16352] dead-lock in std.allocator.free_list unittest

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Dec 22 02:37:30 PST 2016


https://issues.dlang.org/show_bug.cgi?id=16352

safety0ff.bugz <safety0ff.bugz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz at gmail.com

--- Comment #6 from safety0ff.bugz <safety0ff.bugz at gmail.com> ---
SharedFreeList.allocate looks ABA prone:

A thread does:
    do
    {
        oldRoot = _root; // atomic load
        if (!oldRoot) return allocateFresh(bytes);
        next = oldRoot.next; // atomic load
    }
    while (!cas(&_root, oldRoot, next));

But the value of `next` could have changed between the load and the cas.

--


More information about the Digitalmars-d-bugs mailing list