Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Job does not sleep [org.eclipse.core.runtime.jobs.Job]
Job does not sleep [org.eclipse.core.runtime.jobs.Job] [message #1082468] Thu, 08 August 2013 15:58
Stefan Snooc is currently offline Stefan Snooc
Messages: 12
Registered: January 2013
Junior Member
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
Previous Topic:Appearance preferences unable to find themes
Next Topic:Eclipse Update site not clearing older versions
Goto Forum:
  


Current Time: Sat Oct 25 14:39:40 GMT 2014

Powered by FUDForum. Page generated in 0.01895 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software