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;
}
}
}
}
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">