A way to cleanly stop calculating

Issue #32 resolved
dsmic created an issue

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)

  1. Francois van Niekerk repo owner

    Does Engine::stopThinking() not suffice? Do you also want the memory to be freed?

  2. dsmic 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?

  3. Francois van Niekerk 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.

  4. dsmic 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:)

  5. Francois van Niekerk 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.

  6. Log in to comment