The idea is that multiple shared objects use a common lock.


```
import std.stdio;

void main()
{

}

class BankAccount
{

}

void transferMoney(shared BankAccount from,     shared BankAccount to)
{
synchronized (from, to) ← FAILS TO COMPILE. Doesn't like comma.
        { // ← correct
                // ...
        }
}

```

This fails to compile with dmd 2.111.0
```
c:\dev\D\81 - 90\c86_4f_multiple_synchronized\source\app.d(15): Error: using the result of a comma expression is not allowed
    synchronized (from, to)
                  ^
```

Is there another way to do this, other than manually, or is this obsolete?

Reply via email to