Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Obtain thread lock  RSS feed

 
Santosh Kumar Nayak
Ranch Hand
Posts: 193
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
When I say that a thread has obtained a lock on the monitor of an Object. What happens internally ?
 
Campbell Ritchie
Marshal
Posts: 55715
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean how is it implemented? If you go through the Java® Language Specification I think you will find that is not specified. Nor does the Virtual Machine Specification (try §2.11 and §3.14) give anything definite.

Obviously each object has a monitor which is probably implemented by changing a bit in it from 0 to 1 and vice versa, but for more details you will have to download something like OpenJDK and go through its source code.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!