1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Use a preference for the timeout launch setting.

This commit is contained in:
Alain Magloire 2003-10-29 17:35:38 +00:00
parent 188ecd7e38
commit 0eae65c6f6
3 changed files with 25 additions and 9 deletions

View file

@ -22,6 +22,16 @@ public interface IMIConstants
* Preference key for default MI request timeout value.
*/
public static final String PREF_REQUEST_TIMEOUT = PLUGIN_ID + ".PREF_REQUEST_TIMEOUT"; //$NON-NLS-1$
/**
* Preference key for default MI launch request timeout value.
*/
public static final String PREF_REQUEST_LAUNCH_TIMEOUT = PLUGIN_ID + ".PREF_REQUEST_LAUNCH_TIMEOUT"; //$NON-NLS-1$
/**
* The default MI request timeout when no preference is set.
*/
public static final int DEF_REQUEST_LAUNCH_TIMEOUT = 30000;
/**
* The default MI request timeout when no preference is set.

View file

@ -71,8 +71,8 @@ public class MIPlugin extends Plugin {
* @throws MIException
* @return MISession
*/
public MISession createMISession(Process process, PTY pty, int timeout, int type) throws MIException {
return new MISession(process, pty, timeout, type);
public MISession createMISession(Process process, PTY pty, int timeout, int type, int launchTimeout) throws MIException {
return new MISession(process, pty, timeout, type, launchTimeout);
}
/**
@ -87,7 +87,8 @@ public class MIPlugin extends Plugin {
MIPlugin plugin = getDefault();
Preferences prefs = plugin.getPluginPreferences();
int timeout = prefs.getInt(IMIConstants.PREF_REQUEST_TIMEOUT);
return createMISession(process, pty, timeout, type);
int launchTimeout = prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
return createMISession(process, pty, timeout, type, launchTimeout);
}
/**
@ -344,10 +345,15 @@ public class MIPlugin extends Plugin {
syncStartup.start();
synchronized (pgdb) {
int timeout = getAdjustedTimeout(program);
MIPlugin plugin = getDefault();
Preferences prefs = plugin.getPluginPreferences();
int launchTimeout = prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
if (launchTimeout <= 0) {
launchTimeout = getAdjustedTimeout(program);
}
while (syncStartup.isAlive()) {
try {
pgdb.wait(timeout);
pgdb.wait(launchTimeout);
break;
} catch (InterruptedException e) {
}

View file

@ -89,7 +89,7 @@ public class MISession extends Observable {
* @param timeout time in milliseconds to wait for command response.
* @param type the type of debugin session.
*/
public MISession(Process process, PTY pty, int timeout, int type) throws MIException {
public MISession(Process process, PTY pty, int timeout, int type, int launchTimeout) throws MIException {
gdbProcess = process;
inChannel = process.getInputStream();
@ -142,15 +142,15 @@ public class MISession extends Observable {
// Like confirmation and screen size.
MIGDBSet confirm = new MIGDBSet(new String[]{"confirm", "off"});
postCommand(confirm);
postCommand(confirm, launchTimeout);
confirm.getMIInfo();
MIGDBSet width = new MIGDBSet(new String[]{"width", "0"});
postCommand(width);
postCommand(width, launchTimeout);
confirm.getMIInfo();
MIGDBSet height = new MIGDBSet(new String[]{"height", "0"});
postCommand(height);
postCommand(height, launchTimeout);
confirm.getMIInfo();
}