At work time, u listen music or not ??
@hiteshnihalani (2121)
India
8 responses
@kabir_helboy (301)
• India
15 Jan 07
actually i listen music every where when i get a chance and i also sing songs in my heart normally everytime . its my best way to reduce tension. thanks for posting this discussion.
@puri_puneet2003 (1220)
• India
26 Dec 06
yes ofcourse, i think thts the best place to listen to music........ wat say ha........
prog. u wanted......
/* DEADLOCK USING SUSPEND,RESUME */
class NewThread implements Runnable
{
String name;
Thread t;
boolean suspendFlag;
NewThread(String threadname)
{
name = threadname;
t=new Thread(this,name);
System.out.println("New thread : "+t);
suspendFlag = false;
t.start();
}
public void run()
{
try
{
for(int i=15;i0;i--)
{
System.out.println(name +":"+i);
Thread.sleep(200);
synchronized(this)
{
while(suspendFlag)
{
wait();
}
}
}
}
catch(InterruptedException e)
{
System.out.println(name +" INTERRUPTED ");
}
System.out.println(name + "EXITING");
}
void mysuspend()
{
suspendFlag = true;
}
synchronized void myresume()
{
suspendFlag = false;
notify();
}
}
class SuspendResume
{
public static void main(String args[])
{
NewThread ob1 = new NewThread("ONE");
NewThread ob2 = new NewThread("TWO");
try
{
Thread.sleep(1000);
ob1.mysuspend();
System.out.println("Suspending thread one");
Thread.sleep(1000);
ob1.myresume();
System.out.println("Resuming thread one");
ob2.mysuspend();
System.out.println("Suspending thread two");
Thread.sleep(1000);
ob2.myresume();
System.out.println("Resuming thread two");
}
catch(InterruptedException e)
{
System.out.println("Main thread Interrupted ");
}
try
{
System.out.println("Waiting for threads to finish.");
ob1.t.join();
ob2.t.join();
}
catch(InterruptedException e)
{
System.out.println("Main thread Interrupted ");
}
System.out.println("Main thread exiting ");
}
}