ThreadPool Threads; // Global object
-/// Thread constructor launches the thread and waits until it goes to sleep
-/// in idle_loop(). Note that 'searching' and 'exit' should be already set.
+// Thread constructor launches the thread and waits until it goes to sleep
+// in idle_loop(). Note that 'searching' and 'exit' should be already set.
Thread::Thread(size_t n) : idx(n), stdThread(&Thread::idle_loop, this) {
}
-/// Thread destructor wakes up the thread in idle_loop() and waits
-/// for its termination. Thread should be already waiting.
+// Thread destructor wakes up the thread in idle_loop() and waits
+// for its termination. Thread should be already waiting.
Thread::~Thread() {
}
-/// Thread::clear() reset histories, usually before a new game
+// Thread::clear() reset histories, usually before a new game
void Thread::clear() {
}
-/// Thread::start_searching() wakes up the thread that will start the search
+// Thread::start_searching() wakes up the thread that will start the search
void Thread::start_searching() {
mutex.lock();
}
-/// Thread::wait_for_search_finished() blocks on the condition variable
-/// until the thread has finished searching.
+// Thread::wait_for_search_finished() blocks on the condition variable
+// until the thread has finished searching.
void Thread::wait_for_search_finished() {
}
-/// Thread::idle_loop() is where the thread is parked, blocked on the
-/// condition variable, when it has no work to do.
+// Thread::idle_loop() is where the thread is parked, blocked on the
+// condition variable, when it has no work to do.
void Thread::idle_loop() {
// If OS already scheduled us on a different group than 0 then don't overwrite
// the choice, eventually we are one of many one-threaded processes running on
// some Windows NUMA hardware, for instance in fishtest. To make it simple,
- // just check if running threads are below a threshold, in this case all this
+ // just check if running threads are below a threshold, in this case, all this
// NUMA machinery is not needed.
if (Options["Threads"] > 8)
WinProcGroup::bindThisThread(idx);
}
}
-/// ThreadPool::set() creates/destroys threads to match the requested number.
-/// Created and launched threads will immediately go to sleep in idle_loop.
-/// Upon resizing, threads are recreated to allow for binding if necessary.
+// ThreadPool::set() creates/destroys threads to match the requested number.
+// Created and launched threads will immediately go to sleep in idle_loop.
+// Upon resizing, threads are recreated to allow for binding if necessary.
void ThreadPool::set(size_t requested) {
}
-/// ThreadPool::clear() sets threadPool data to initial values
+// ThreadPool::clear() sets threadPool data to initial values
void ThreadPool::clear() {
}
-/// ThreadPool::start_thinking() wakes up main thread waiting in idle_loop() and
-/// returns immediately. Main thread will wake up other threads and start the search.
+// ThreadPool::start_thinking() wakes up main thread waiting in idle_loop() and
+// returns immediately. Main thread will wake up other threads and start the search.
void ThreadPool::start_thinking(Position& pos, StateListPtr& states,
const Search::LimitsType& limits, bool ponderMode) {
std::map<Move, int64_t> votes;
Value minScore = VALUE_NONE;
- // Find minimum score of all threads
+ // Find the minimum score of all threads
for (Thread* th: threads)
minScore = std::min(minScore, th->rootMoves[0].score);
}
-/// Start non-main threads
+// Start non-main threads
void ThreadPool::start_searching() {
}
-/// Wait for non-main threads
+// Wait for non-main threads
void ThreadPool::wait_for_search_finished() const {