The monitor object synchronizes access to an object by limiting access to it. According to the monitor object patterns, the object should be accessed only by one client at any point in time. Each object will have a:

  • Monitor lock: This guarantees that only one client can execute a member function of the object.
  • Monitor condition: This notifies the waiting clients.

UML diagram

Let’s have a look at the monitor pattern’s UML diagram.

Get hands-on with 1200+ tech skills courses.