Skip to content

Glossary: System Design Basics in C#

lock

Also written: lock block

A C# statement that lets only one thread at a time run the code inside its block. It is used to make a check-and-subtract on stock atomic and to model a database transaction.

Where the book teaches it

Related terms

AtomicRace conditionTransaction