mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
DroidFish: Nicer shutdown of external engines.
Give the engine a chance to shutdown cleanly before killing it by force. This fixes occasional "text file busy" problems when switching between two engines.
This commit is contained in:
parent
6277419793
commit
817fbe471a
|
@ -288,8 +288,17 @@ public class ExternalEngine extends UCIEngineBase {
|
|||
if (exitThread != null)
|
||||
exitThread.interrupt();
|
||||
super.shutDown();
|
||||
if (engineProc != null)
|
||||
if (engineProc != null) {
|
||||
for (int i = 0; i < 25; i++) {
|
||||
try {
|
||||
engineProc.exitValue();
|
||||
break;
|
||||
} catch (IllegalThreadStateException e) {
|
||||
try { Thread.sleep(10); } catch (InterruptedException e2) { }
|
||||
}
|
||||
}
|
||||
engineProc.destroy();
|
||||
}
|
||||
engineProc = null;
|
||||
if (stdInThread != null)
|
||||
stdInThread.interrupt();
|
||||
|
|
Loading…
Reference in New Issue
Block a user