mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-21 05:02:17 +01:00
DroidFish: Fixed potential threading problems.
This commit is contained in:
@@ -189,7 +189,7 @@ public class DroidChessController {
|
|||||||
listener = new SearchListener();
|
listener = new SearchListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setBookOptions(BookOptions options) {
|
public final synchronized void setBookOptions(BookOptions options) {
|
||||||
if (!bookOptions.equals(options)) {
|
if (!bookOptions.equals(options)) {
|
||||||
bookOptions = options;
|
bookOptions = options;
|
||||||
if (computerPlayer != null) {
|
if (computerPlayer != null) {
|
||||||
@@ -230,8 +230,6 @@ public class DroidChessController {
|
|||||||
computerPlayer.setListener(listener);
|
computerPlayer.setListener(listener);
|
||||||
computerPlayer.setBookOptions(bookOptions);
|
computerPlayer.setBookOptions(bookOptions);
|
||||||
}
|
}
|
||||||
computerPlayer.setEngineStrength(engine, strength);
|
|
||||||
computerPlayer.setNumPV(numPV);
|
|
||||||
game = new Game(computerPlayer, gameTextListener, timeControl, movesPerSession, timeIncrement);
|
game = new Game(computerPlayer, gameTextListener, timeControl, movesPerSession, timeIncrement);
|
||||||
setPlayerNames(game);
|
setPlayerNames(game);
|
||||||
updateGameMode();
|
updateGameMode();
|
||||||
@@ -855,13 +853,13 @@ public class DroidChessController {
|
|||||||
game.timeController.setTimeControl(timeControl, movesPerSession, timeIncrement);
|
game.timeController.setTimeControl(timeControl, movesPerSession, timeIncrement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void stopSearch() {
|
public final synchronized void stopSearch() {
|
||||||
if (computerThread != null) {
|
if (computerThread != null) {
|
||||||
computerPlayer.stopSearch();
|
computerPlayer.stopSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void stopPonder() {
|
public final synchronized void stopPonder() {
|
||||||
if ((computerThread != null) && humansTurn())
|
if ((computerThread != null) && humansTurn())
|
||||||
stopComputerThinking();
|
stopComputerThinking();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user