A way to cleanly stop calculating
I need to cleanly stop oakfoam from calculating a move.
my idea is: if I call boardsize or clear_board the calculation should be stopped.
Comments (8)
-
repo owner -
repo owner - changed status to resolved
-
reporter Ohh, it is not enough. I must be sure that it stoped thinking before e.g. changing boardsize.
Or did I miss another function?
-
reporter - changed status to open
-
repo owner It is important to note that Engine does not have a thread-safe interface. If you are sending commands via the GTP Engine, then you just need to send the next command after calling stopThinking(), and the commands will be executed sequentially.
-
reporter Yes you are right. I have generateMove running in a queue (something like an iOS thread), can send stopThinking and go on after the generateMove is returned.
This should be save, if I understood correctly. If you agree, reclose the issue again:)
-
repo owner This should work. There are a few commands that can be called in another thread (such a stopThinking()), but just be aware that some things might break if you have multiple threads working on Engine.
-
repo owner - changed status to resolved
- Log in to comment
Does Engine::stopThinking() not suffice? Do you also want the memory to be freed?