• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What exactly is the "monitor"

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I am beginning with threads. I have read about the monitor. I know that a thread wishing to execute a synhcronized method/block must enter the objects monitor. What exactly is the monitor? Where is it located?

[This message has been edited by Joshua White (edited June 05, 2001).]
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Monitoring and locking an object are essentially the same thing. I think of monitor as the process by which a thread determines if it can gain a lock on an object. In other words, you can use the lock variable as a way to monitor an object to see if it is available to your thread. The Object class has a lock instance variable. The lock variable is ignored by default for overhead reasons, but once the synchronized keyword is used it indicates that the object should now pay attention to the lock variable and use it for controlling access to it. Hope this helps!
Cheers,
RL
 
reply
    Bookmark Topic Watch Topic
  • New Topic