Page 1 of 1

Communication problem between engine and interface

PostPosted: 10 Nov 2007, 22:55
by Patrice Duhamel
I have a strange problem with the informations sent by my engine to the interface. ("info" command in UCI engine)

on my Pentium IV 3.0GHz (Hyperthreading) it works.
on some other computers, It works... but the result is shown only after the engine has finished to think.

I think this may happens because I'm using a thread to execute the search function ?
I create a thread for the search to be able to receive information from the interface while thinking.

or there is a problem with the function I'm using to communicate with the interface ?
I'm using fgets() on stdin to get command from the interface, and sending information with a fprintf() to stdout,
followed by a fflush() to be sure the command is sent.

someone already had this problem ?

Re: Communication problem between engine and interface

PostPosted: 10 Nov 2007, 23:05
by Aleks Peshkov
If you gather incoming commands in one thread and send response to GUI in another thread then you may have problems because your version of stdio library may not be designed to be thread safe.

Re: Communication problem between engine and interface

PostPosted: 11 Nov 2007, 14:14
by Patrice Duhamel
Thank you, locking the thread before sending output to the interface seems to solve the problem.