-
- // Wait for the threads to be all sleeping and reset flags
- // to a known state.
- for (int i = 1; i < ActiveThreads; i++)
- {
- while (!threads[i].sleeping);
-
- assert(threads[i].idle);
- assert(threads[i].running);
- assert(!threads[i].workIsWaiting);
-
- // These two flags can be in a random state
- threads[i].stopRequest = threads[i].printCurrentLineRequest = false;
- }
- }
-
- // print_current_line() prints _once_ the current line of search for a
- // given thread and then setup the print request for the next thread.
- // Called when the UCI option UCI_ShowCurrLine is 'true'.
-
- void ThreadsManager::print_current_line(SearchStack ss[], int ply, int threadID) {
-
- assert(ply >= 0 && ply < PLY_MAX);
- assert(threadID >= 0 && threadID < ActiveThreads);
-
- if (!threads[threadID].printCurrentLineRequest)
- return;
-
- // One shot only
- threads[threadID].printCurrentLineRequest = false;
-
- if (!threads[threadID].idle)
- {
- lock_grab(&IOLock);
- cout << "info currline " << (threadID + 1);
- for (int p = 0; p < ply; p++)
- cout << " " << ss[p].currentMove;
-
- cout << endl;
- lock_release(&IOLock);
- }
-
- // Setup print request for the next thread ID
- if (threadID + 1 < ActiveThreads)
- threads[threadID + 1].printCurrentLineRequest = true;