<div style='background-color: none transparent;'></div>
Home » » Deadlock state of a thread

Deadlock state of a thread

class Flintstone
{
int field_1;
int field_2;
private Object lock_1 = new int[1];
private Object lock_2 = new int[1];

public void fred( int value )
{
synchronized( lock_1 )
{
synchronized( lock_2 )
{
field_1 = 0;
field_2 = 0;
}
}
}

public void barney( int value )
{
synchronized( lock_2 )
{
synchronized( lock_1 )
{
field_1 = 0;
field_2 = 0;
}
}
}
}

Share this article :
 
Copyright © 2011. B.Sc B.Tech MCA Ploytechnic Mini,Main Projects | Free Main Projcets Download | MCA |B.tech . All Rights Reserved
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Template Modify by Creating Website. Inpire by Darkmatter Rockettheme Proudly powered by Blogger