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

wait() method in Thread

 
Anthony Karta
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please assume this code are inside a instance



looks weir to me.

synchronized(b) --> "get" lock on b instance
b.wait()--> "release" lock on b instance ??

my questions are:
1. #<b>releases the lock</b># --> whose lock? b or a?
2. #<b>the lock</b># --> again whose lock? b or a?
 
Xiao Song
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is a??
 
Sanjeev Singh
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anthony,

Anthony posted November 23, 2006 04:42 PM
looks weir to me.

synchronized(b) --> "get" lock on b instance
b.wait()--> "release" lock on b instance ??


This is the only truth.
 
Bin Qian
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

my questions are:
1. #<b>releases the lock</b># --> whose lock? b or a?
2. #<b>the lock</b># --> again whose lock? b or a?

I think
1.release all the locks the b holds
2.b
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic