This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads

 
Willie Toma
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"A new lock is obtained for each entry into a synchronized code block."
Is each entry an object? What exactly is it...
Thanks in advance
 
John Dale
Ranch Hand
Posts: 399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By entry, they mean when the flow of execution of the program progresses from a statement outside the block to the inside of the block. (Method returns don't count.)
Does that answer address your question, or were you asking about the nature of the lock itself?
 
Willie Toma
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So for each block of code you can only have one entry?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No- if a method calls itself recursively, for example, a single block of code may be entered more than once, and each time a new lock is obtained on the same monitor. So a given monitor can have multiple locks held on it at the same time - the only catch is, they all have to be held by the same thread.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic