Locking Statements

A locking statement protects a block of code to be only run from a single thread at a time.

Example:

var mylock := new Object;
...
locking mylock do begin
  // thread sensitive operations.
end;

Limitation on Island

locking statements and locking Expressions are limited to work on Monitor classes, on the Island-based platforms. On the other platforms, any type can be locked on.

See Also