SYNTAX

lock statement

Synchronizes a critical section using a consistent gate.

Formal Syntax & Structure

csharp syntaxcsharp
lock (gate) { available--; reserved++; }

Working Example

Example Snippetcsharp
// Documentary fragment; see linked lesson for context.lock (gate) { available--; reserved++; }
C# & .NET Reference