I am about to implement a debugger for Eclipse. For this I want to use a org.eclipse.core.runtime.jobs.Job; Objetct to handle the event when my debugging device reaches a breakpoint. In this case thread.resume() returns. Even though the thread is suspended, Job does not sleep:
@Override
protected IStatus run(IProgressMonitor monitor) {
while (isTerminated() == false) {
try {
if (thread.isSuspended() == true) {
System.out.println("program suspended");
if(sleep() == true) { // wait for someone to wake me up
System.out.println("job is sleeping");
} else {
System.out.println("cannot sleep");
}
} else {
thread.resume();
}
} catch (DebugException e) {
e.printStackTrace();
}
}
return Status.OK_STATUS;
}
Output:
program suspended
cannot sleep
<repeat to infinity>
If anyone is on stackoverflow, then you can answer this question here and I gladly will mark your answer if it's correct.
Thank you