On Sunday, 31 August 2025 at 01:34:18 UTC, Steven Schveighoffer wrote:

The correct way to do this is a nested synchronized statement:

```d
synchronized(from) synchronized(to)
{
   ...
}
```

-Steve

This code compiles:
```
import std.stdio;

void main()
{

}

class BankAccount
{

}

void transferMoney(shared BankAccount from,     shared BankAccount to)
{
        synchronized (from) synchronized (to)   // ← correct
        {
                // ...
        }
}

```

Reply via email to