Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock in threads

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Can anybody tell me which are the methods other then wait(), which compels the thread to release the lock.
thanks
Shikhar
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
stop
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sanjay,
thanks for reply.
What about yield() and sleep()
 
satish
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A thread does not lose ownership of any monitors when it encounters sleep. So, unlock action doesn't happen because of sleep method.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the method interrupt(), and since we are talking about depreciated methods (like stop()) then suspend() as well, will get the thread to release its lock. That leads me to wonder on a tangent. Since, and when, wait() can be timed, is it guaranteed to resume control of the lock irregardless of the priority of any threads that were using the synched code while wait() was counting? I realize that it would be an exception to the general fact that there seems to be little guarantee of any execution of prioritized interrelation between threads, but I have adopted a paranoiac disbelief in making general conclusions of Java's behavioristics. Any corrections or comments here?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic