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 Island. On the other platforms, any type can be locked on.

See Also