-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oups complete previous (early) commit.
Bug fixes: - AbstractEngine, after a go wtime xxx that ends with an exception, a go command (without time options) continues to use the previous max time. - AbstractEngine hanged with no transposition table
- Loading branch information
Showing
13 changed files
with
231 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
package com.fathzer.jchess.uci; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.concurrent.Callable; | ||
|
||
/** A task that will be executed in the background of UCI interface. | ||
/** A task that can be stopped. | ||
* <br>Please note that stoppable is different from {@link java.util.concurrent.Cancellable} | ||
* When a task is cancelled, it produces no result (for example, a {@link java.util.concurrent.CancellationException} if the task was cancelled). | ||
* The typical use case of a StoppableTask is a best move search engine that performs iterative deepening. You may want to stop its deepening and get the current result. | ||
* @param <T> The result of the task | ||
*/ | ||
public abstract class LongRunningTask<T> { | ||
private final AtomicBoolean stopped; | ||
|
||
protected LongRunningTask() { | ||
stopped = new AtomicBoolean(); | ||
} | ||
|
||
public abstract T get(); | ||
|
||
public boolean isStopped() { | ||
return stopped.get(); | ||
} | ||
|
||
public void stop() { | ||
stopped.set(true); | ||
} | ||
public interface StoppableTask<T> extends Callable<T> { | ||
/** Stops the task. | ||
*/ | ||
void stop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.