[Issue 22555] Recursively locked mutexes are not fully released by Condition.wait

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 30 18:59:01 UTC 2021


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

--- Comment #5 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
Actually, no, I'm not blind :)

task {
    synchronized (a) // lock, counter = 1
    {
        a.wait(5)
        {
            // `this` is a
            synchronized (this) // already locked, counter = 2
            {
                // So at this point, you've recursed twice
                // hence main thread blocks in set()
                condition.wait; // counter = 1, not unlocked
                // counter = 2
            }
        }
    }
}

---

synchronized(a) in task should be removed

--


More information about the Digitalmars-d-bugs mailing list