mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-22 18:17:02 +08:00
Standardize Comments
use double slashes (//) only for comments. closes #4820 No functional change.
This commit is contained in:
committed by
Joost VandeVondele
parent
fe53a18f7a
commit
edb4ab924f
@@ -40,8 +40,8 @@ namespace Stockfish {
|
||||
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) {
|
||||
|
||||
@@ -49,8 +49,8 @@ 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() {
|
||||
|
||||
@@ -62,7 +62,7 @@ Thread::~Thread() {
|
||||
}
|
||||
|
||||
|
||||
/// Thread::clear() reset histories, usually before a new game
|
||||
// Thread::clear() reset histories, usually before a new game
|
||||
|
||||
void Thread::clear() {
|
||||
|
||||
@@ -78,7 +78,7 @@ 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();
|
||||
@@ -88,8 +88,8 @@ void Thread::start_searching() {
|
||||
}
|
||||
|
||||
|
||||
/// 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() {
|
||||
|
||||
@@ -98,15 +98,15 @@ 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);
|
||||
@@ -127,9 +127,9 @@ void Thread::idle_loop() {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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) {
|
||||
|
||||
@@ -158,7 +158,7 @@ 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() {
|
||||
|
||||
@@ -172,8 +172,8 @@ 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) {
|
||||
@@ -225,7 +225,7 @@ Thread* ThreadPool::get_best_thread() const {
|
||||
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);
|
||||
|
||||
@@ -256,7 +256,7 @@ Thread* ThreadPool::get_best_thread() const {
|
||||
}
|
||||
|
||||
|
||||
/// Start non-main threads
|
||||
// Start non-main threads
|
||||
|
||||
void ThreadPool::start_searching() {
|
||||
|
||||
@@ -266,7 +266,7 @@ void ThreadPool::start_searching() {
|
||||
}
|
||||
|
||||
|
||||
/// Wait for non-main threads
|
||||
// Wait for non-main threads
|
||||
|
||||
void ThreadPool::wait_for_search_finished() const {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user