[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] [DSF] GDBBackend.MonitorJob.kill not working?

Hi,

I have to agree this seems suspicious, but in the end it works.
Inside the call to run(IProgressMonitor monitor), there is a call that
you didn't show in your mail:

   fMonProcess.waitFor(); 

this in turn calls wait() which releases the lock on fMonProcess.
I've actually tried it and things work as expected.
I'm not sure if this was thought out properly or if we got lucky :)

Marc


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Vladimir Prus
> Sent: Thursday, April 19, 2012 7:09 AM
> To: CDT General developers list.
> Subject: [cdt-dev] [DSF] GDBBackend.MonitorJob.kill not working?
> 
> 
> I am looking at GDBBackend.MonitorJob.kill, and not quite 
> sure how it can work. The
> code is:
> 
> 	 void kill() {
>              synchronized(fMonProcess) {
>                  if (!fMonitorExited) {
>                      getThread().interrupt();
>                  }
>              }
>          }
> 
> So, it tries to interrupt the worker thread. However, the 
> worker thread does this:
> 
> 	IStatus run(IProgressMonitor monitor) {
>              synchronized(fMonProcess) {
> 	    }
>          }
> 
> It seems like 'kill' won't get a change to call 'interrupt' 
> until 'run' has exited, which
> makes 'kill' entirely unhelpful?
> 
> Thanks,
> 
> -- 
> Vladimir Prus
> CodeSourcery / Mentor Graphics
> http://www.mentor.com/embedded-software/
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>