Lock thread by the synchronized block

 The Alinous-Core supports synchronized block to lock the thread. There are 2 type of usage.

Synchronized block

 If the synchronized block used without name, threads are synchronized at the block. A single thread can execute the code inside the block.

Locking scope

 The scope of locking in only in this block. If synchronized block is used at other line, or other script, it has nothing todo with them.

Named synchronized block

 You can name the synchronized block.A single thread can execute the code inside the named block which has same name.

The lock is managed by the name. The name is String type variable.

Locking scope

 Named synchronized block's locking scope is global. If same name is used at other script or other line, they are synchronized.

Name of the synchronized block

 The name of the synchronized block is just a string. You can specify it by using variable or static string.


Go to Top