Well, you'll make yourself more troubles very soon. I strongly recommend you don't try to attempt it. Because you will need to rework the whole thing very soon....lucasart wrote:
Another thing I will need is to block/unblock processes. Do you know how to do that (in POSIX) ? When I play A vs. B, if it's A's turn to play, I want to block B, let A calculate, and when it's B's turn I unblock it. The point is that B could be in a polling loop: if B uses blocking I/O (which is the correct way and I suppose any normal engine does that) then there's no real issue, but if it uses a loop with non blocking I/O it steals CPU ressources from A. Also I want to disable pondering in a forceful way, so as to control it.
Anyway, you're talking about synchronization. There're many ways. You might try to use asynchronous messages.
Send a "STOP" message from A to B, when B reads it, immediately block itself. So on...
In any decent GUI, there must be a thread for block polling. I strongly recommend you go straight into creating threads for polling. If you're in doubt, please read Polyglot, it has a very nice implementation.