File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deadlock

 
Sudhanshu Mishra
Ranch Hand
Posts: 235
1
Eclipse IDE Fedora Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am a bit confused about following code's output.



Why a deadlock is not happening,because the main method has locked td and hence after td.start(),the run method should have a lock on td.But the point is that does the run method ever has a lock on td,or is it the XMap object?

Please clarify...
Thanks...
 
Ankit Garg
Sheriff
Posts: 9496
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right, the run method obtains the lock on the XMap object not the Thread object...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic