Begin critical block

Command group Flag affected Reversible Execute on client Platform(s)
Threads NO NO NO All


Begin critical block


Begin critical block is only applicable to the multithreaded server. It marks the start of a critical block, namely a section of code which needs to execute in single threaded mode without allowing other client methods to execute. You use End critical block to mark the end of a critical block.

One example of when you should use a critical block is as follows. Class variables are shared by all clients. Simple atomic operations, such as the direct assignment of a value to a class variable are safe. Other operations, such as when a method call is involved, could cause problems, because the method call might be interrupted by another thread. To avoid this, use a critical block.


Begin critical block
  Calculate cClassVar as $cinst.$getvalue()
End critical block