1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-16 12:45:41 +02:00

Bug 365601: GUI can become unresponsive when starting a debug launch

This commit is contained in:
Marc Khouzam 2012-07-20 08:41:19 -04:00
parent 273e46b409
commit 2507788546

View file

@ -16,6 +16,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor; import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
@ -97,11 +99,18 @@ public class GdbConnectCommand implements IConnect {
}; };
try { try {
fExecutor.execute(canConnectQuery); fExecutor.execute(canConnectQuery);
return canConnectQuery.get(); return canConnectQuery.get(50, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} catch (ExecutionException e) { } catch (ExecutionException e) {
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown // Can be thrown if the session is shutdown
} catch (TimeoutException e) {
// Bug 365601
// Don't wait forever so as to not lock the UI and
// potentially create a deadlock.
// If we timeout, we just return false and disable
// the connect command. The next call to this method
// should succeed and fix this.
} }
return false; return false;