Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Statements > Compound statements > Synchronized

Synchronized

A synchronized statement acquires a mutual-exclusion lock on behalf of the executing thread, executes a contained statement, then releases the lock. While the executing thread owns the lock, no other thread may acquire the lock.

Statement is executed by evaluating the expression and thread locks are assosiated with returned value. Lock is released when statements ends, either normally or abruptly.

  synchronized := "synchronized" "(" expr-startobject ")" statement 
See also  | Statements  | Compound statements  | Grammar
Contributes notes:
Add a note
What's new | Anvil