mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-19 08:52:15 +01:00
avoid queuing a lot of threads while waiting for platform
This commit is contained in:
parent
72c337d88d
commit
bf11c7f395
@ -56,13 +56,6 @@ public class SerialBoardsLister extends TimerTask {
|
||||
}
|
||||
|
||||
public synchronized void retriggerDiscovery(boolean polled) {
|
||||
while (BaseNoGui.packages == null) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
Platform platform = BaseNoGui.getPlatform();
|
||||
if (platform == null) {
|
||||
return;
|
||||
@ -103,6 +96,11 @@ public class SerialBoardsLister extends TimerTask {
|
||||
String[] parts = newPort.split("_");
|
||||
String port = parts[0];
|
||||
|
||||
if (parts.length != 3) {
|
||||
// something went horribly wrong
|
||||
continue;
|
||||
}
|
||||
|
||||
Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages);
|
||||
|
||||
BoardPort boardPort = null;
|
||||
@ -168,6 +166,9 @@ public class SerialBoardsLister extends TimerTask {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (BaseNoGui.packages == null) {
|
||||
return;
|
||||
}
|
||||
retriggerDiscovery(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user