Problem when changing tasks/focus under windows.
Posted: 25 Aug 2005, 14:16
Hi all,
I?m just trying to fix a problem that occurs when my engine is used in console mode. I tried to solve some simple mate positions and observed that the engine kind of stopps when I change to another application and then switch back to the console where the engine is (or better should) be calculating. I can continue (note it?s continue and not restarting) the calculation by pressing enter in the console and the calculation continues where it stopped. It?s not only a delayed output as the taskmanager shows that the engine powers down completely. Assuming that the problem is somehow related to my checkinput() function I changed the checkinput() function to use kbhit() when in console mode instead of using the bioskey() stuff which depends on the windows api. Still the problem remains.
Any ideas what I?m doing wrong? Maybe it?s just a compiler switch I?m missing ?
Best regards
Roman
checkinput() looks like that:
checkinput() is called from the search:
I?m just trying to fix a problem that occurs when my engine is used in console mode. I tried to solve some simple mate positions and observed that the engine kind of stopps when I change to another application and then switch back to the console where the engine is (or better should) be calculating. I can continue (note it?s continue and not restarting) the calculation by pressing enter in the console and the calculation continues where it stopped. It?s not only a delayed output as the taskmanager shows that the engine powers down completely. Assuming that the problem is somehow related to my checkinput() function I changed the checkinput() function to use kbhit() when in console mode instead of using the bioskey() stuff which depends on the windows api. Still the problem remains.
Any ideas what I?m doing wrong? Maybe it?s just a compiler switch I?m missing ?
Best regards
Roman
checkinput() looks like that:
- Code: Select all
int check_input()
{
int data, bytes;
char input[255]="", *endc;
char c;
setbuf(stdout, NULL);
setbuf(stdin, NULL);
data = 0;
/* console stuff */
if (CONSOLE && kbhit()) {
c = getche();
if (c == 'q' || c == 'Q')
{
search_time = 0;
return 1;
}
else
return 0;
}
/* winboard, UCI part */
...
checkinput() is called from the search:
- Code: Select all
...
--checknodes;
if (checknodes < 0) {
in = 0;
in = check_input();
if (clock() + 50 > search_time || in == TRUE) {
exit_search = 1;
return alpha;
}
checknodes = 1024;
}
...