jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Deadlock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Deadlock" Watch "Deadlock" New topic
Author

Deadlock

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 235
    
    1

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...


Thanks,
Sudhanshu(OCPJP,OCEJPAD)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9435
    
  20

You are right, the run method obtains the lock on the XMap object not the Thread object...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deadlock
 
It's not a secret anymore!