Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wait and notify problem from K&B.

 
aruna dabas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Dear Friends
i am not understanding that when i am commenting notify() still why i am getting total in main ThreadA .please explain me.
Thanking You.
 
Henry Wong
author
Marshal
Pie
Posts: 20995
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, what you are seeing is an implementation detail of the join() method... I explained it a couple of times before. It may be worth it to search the forums...

Here is one of those times...

http://www.coderanch.com/t/234368/Threads-Synchronization/wait-without-notify

Hope this helps,
Henry
 
aruna dabas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got it ,,,Thanks Henry
 
Rafael Angarita
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry guys. But now I'm a little bit confused.

For me these examples of "wait without notify" just work in the same way as using the join() method. I'm just waiting for a thread to die.

Am I missing something here?
 
Ankit Garg
Sheriff
Posts: 9510
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rafael you are right that this works like waiting for a thread to die. But this depends on the internal implementation of the Thread class. So this will not be tested in SCJP...
 
Rafael Angarita
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic