Full Thread Dump...Deadlock occured in the code
The following code generates error saying the following description:
ERROR Start:
SIGBUS occured.
Full thread dump:
"main" (TID:0x66c9360, sys_thread_t:0x7ad4f10, taskId:0x7ae447c state:runnable name:tJmain, stack_base:0x7ae447c, stack_high:0x1080 stack_size:19696) prio=5
"Finalizer thread" (TID:0x66c9390, sys_thread_t:0x7ad0538, taskId:0x7ad4590 state:condition variable pend name:Finalizer threa, stack_base:0x7ad4588, stack_high:0x144 stack_size:15624) prio=1
"Thread-0" (TID:0x66dd778, sys_thread_t:0x6560460, taskId:0x65644b8 state:condition variable pend name:Thread-0, stack_base:0x65644b0, stack_high:0xb48 stack_size:15628) prio=5
Page Fault
Program Counter: 0x0013c6a3
Status Register: 0x00010202
Error Code: 0x00130000
Task: 0x6551d20 "Thread-3"
ERROR End
This is the code..........
public class abc{
private boolean ready;
public synchronized void toggle1() {
ready = false; // de-block the other thread
try {
notify(); // inform the other thread
}catch(IllegalMonitorStateException e) {
e.printStackTrace();
}
while (!ready) {// block until the other
try {// thread sets "ready" to
wait();// "true".
} catch (InterruptedException e) {
System.out.println("Error from toggle1:InterruptedException");
e.printStackTrace();
}
catch(Throwable e)
{
System.out.println("Error from toggle1:Throwable");
e.printStackTrace();
}
}
}
public synchronized void toggle0() {
ready = true;// de-block the other thread
notify();// inform the other thread
while (ready) {// block until the other
try {// thread sets "ready" to
wait();// "false".
} catch (InterruptedException e) {}
}
}
}
Would you please put look into it and suggest a solution
Thanks
Message was edited by:
Indranil.Sarkar

