@@ -24,16 +24,18 @@ its own variable.
2424
2525` synchronized ` blocks are used to tell the compiler
2626to create a critical section that can only be entered
27- by one thread at a time.
27+ by one thread at a time. With no arguments, a unique mutex
28+ for that statement alone will be locked and unlocked.
2829
2930 synchronized {
3031 importStuff();
3132 }
3233
33- Within ` class ` member functions these blocks might be
34- limited to different member objects * mutexes*
35- with ` synchronized(member1, member2) ` to reduce
36- contention. The D compiler inserts * critical
34+ Synchronization can be limited to just a class object's
35+ * mutex* by passing the object as an argument using
36+ ` synchronized (obj) ` to reduce contention.
37+
38+ The D compiler inserts * critical
3739sections* automatically. A whole class can be marked
3840as ` synchronized ` as well in which case the compiler will
3941make sure that just one thread accesses a concrete
@@ -53,7 +55,9 @@ helper:
5355- [ Lock-Based Synchronization with ` synchronized ` ] ( http://www.informit.com/articles/article.aspx?p=1609144&seqNum=13 )
5456- [ Deadlocks and ` synchronized ` ] ( http://www.informit.com/articles/article.aspx?p=1609144&seqNum=15 )
5557- [ ` synchronized ` specification] ( https://dlang.org/spec/statement.html#SynchronizedStatement )
56- - [ Implicit conversions with ` shared ` data types] ( https://dlang.org/spec/const3.html#implicit_conversions )
58+ - [ ` synchronized ` classes] ( https://dlang.org/spec/class.html#synchronized-classes )
59+ - [ ` shared ` type qualifier] ( https://dlang.org/spec/const3.html#shared )
60+ - [ Implicit conversions with ` shared ` data types] ( https://dlang.org/spec/const3.html#implicit_qualifier_conversions )
5761
5862## {SourceCode}
5963
0 commit comments