Thread overview
[Issue 16057] [TDPL] synchronized (a, b) compiles and runs with wrong semantics
Jun 30, 2016
ZombineDev
Jan 24, 2018
yebblies
Sep 24, 2020
mhh
[Issue 16057] [TDPL] synchronized (a, b) does not compile
Dec 04, 2023
Nick Treleaven
May 22, 2016
https://issues.dlang.org/show_bug.cgi?id=16057

--- Comment #1 from Andrei Alexandrescu <andrei@erdani.com> ---
Test code (thanks Steve Schveighoffer) should not print "oops!" but does:


import std.concurrency;
import core.sync.mutex;
import core.thread;
import std.stdio;

__gshared Mutex a;
__gshared Mutex b;

shared static this()
{
    a = new Mutex;
    b = new Mutex;
}

void badThread()
{
    synchronized(a)
    {
        writeln("a is locked!");
        while(1) { Thread.sleep(1.seconds); }
    }
}

void main()
{
    spawn(&badThread);
    Thread.sleep(1.seconds);
    synchronized(a, b)
    {
        writeln("oops!");
    }
}

--
June 30, 2016
https://issues.dlang.org/show_bug.cgi?id=16057

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
                 CC|                            |petar.p.kirov@gmail.com

--
January 24, 2018
https://issues.dlang.org/show_bug.cgi?id=16057

yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com

--- Comment #2 from yebblies <yebblies@gmail.com> ---
*** Issue 18277 has been marked as a duplicate of this issue. ***

--
September 24, 2020
https://issues.dlang.org/show_bug.cgi?id=16057

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |maxhaton@gmail.com
         Resolution|---                         |FIXED

--- Comment #3 from mhh <maxhaton@gmail.com> ---
Since around dmd ~2.078, one cannot use the comma operator at all so this particular construct is no longer an issue

See https://run.dlang.io/is/EL9foO

--
December 04, 2023
https://issues.dlang.org/show_bug.cgi?id=16057

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |TDPL
             Status|RESOLVED                    |REOPENED
                 CC|                            |nick@geany.org
         Resolution|FIXED                       |---
            Summary|[TDPL] synchronized (a, b)  |[TDPL] synchronized (a, b)
                   |compiles and runs with      |does not compile
                   |wrong semantics             |
           Severity|critical                    |normal

--- Comment #4 from Nick Treleaven <nick@geany.org> ---
Reopening as comment #1 shows this issue is for multiple arguments to be supported.

--