Java Language: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Internal= * Java =Statements= ==synchronized== The <tt>synchronized</tt> statement acquires a mutual-exclusion lock on behalf of the executing thread, e...") |
|||
Line 5: | Line 5: | ||
=Statements= | =Statements= | ||
==synchronized== | ==<span id='synchronized_statement'></span>synchronized== | ||
The <tt>synchronized</tt> statement acquires a mutual-exclusion lock on behalf of the executing thread, executes a block, then releases the lock. While the executing thread owns the log, no other thread may acquire the lock. | The <tt>synchronized</tt> statement acquires a mutual-exclusion lock on behalf of the executing thread, executes a block, then releases the lock. While the executing thread owns the log, no other thread may acquire the lock. | ||
Line 12: | Line 12: | ||
The type of ''expression'' must be a reference type. | The type of ''expression'' must be a reference type. | ||
=Modifiers= | |||
==<span id='synchronized_modifier'></span>synchronized== |
Revision as of 03:21, 21 March 2018
Internal
Statements
synchronized
The synchronized statement acquires a mutual-exclusion lock on behalf of the executing thread, executes a block, then releases the lock. While the executing thread owns the log, no other thread may acquire the lock.
synchronized (expression) block
The type of expression must be a reference type.