The most important thing D does, which is fundamentally different, is that variables are thread local by default, and you must opt-in to variables that are shared across threads. Immutable data can be shared implicitly, because there are no writers. This means that if you keep only a small amount of shared state, it should be easy to track down what could possibly be affected by multi-threading issues.

I haven't ever used synchronized classes myself, but it's probably a way of preventing mistakes where you synchronize some methods, but not others. You can also use synchronized {} blocks to introduce some recursive locking for a series of statements. So you could put that inside of a class method.

Reply via email to