Description

The System.Threading.Monitor class controls access to objects by granting a single thread a lock for an object. Object locks provide the ability to restrict access to a block of code, commonly called a critical section. While a thread owns the lock for an object no other thread can acquire the lock for the object. Additionally, the System.Threading.Monitor class can be used to ensure that no other thread may access a section of application code being executed by the lock owner, unless the other thread is executing the code using a different locked object.

The following information is maintained for each synchronized object:

  • A reference to the thread that currently holds the lock.

  • A reference to a “ready queue,” which contains the threads ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.