mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 10:36:26 +08:00
remove blank line between function and it's description
- remove the blank line between the declaration of the function and it's comment, leads to better IDE support when hovering over a function to see it's description - remove the unnecessary duplication of the function name in the functions description - slightly refactored code for lsb, msb in bitboard.h There are still a few things we can be improved later on, move the description of a function where it was declared (instead of implemented) and add descriptions to functions which are behind macros ifdefs closes https://github.com/official-stockfish/Stockfish/pull/4840 No functional change
This commit is contained in:
@@ -40,9 +40,8 @@ namespace Stockfish {
|
||||
ThreadPool Threads; // Global object
|
||||
|
||||
|
||||
// Thread constructor launches the thread and waits until it goes to sleep
|
||||
// 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) {
|
||||
@@ -51,9 +50,8 @@ Thread::Thread(size_t n) :
|
||||
}
|
||||
|
||||
|
||||
// Thread destructor wakes up the thread in idle_loop() and waits
|
||||
// Destructor wakes up the thread in idle_loop() and waits
|
||||
// for its termination. Thread should be already waiting.
|
||||
|
||||
Thread::~Thread() {
|
||||
|
||||
assert(!searching);
|
||||
@@ -64,8 +62,7 @@ Thread::~Thread() {
|
||||
}
|
||||
|
||||
|
||||
// Thread::clear() reset histories, usually before a new game
|
||||
|
||||
// Reset histories, usually before a new game
|
||||
void Thread::clear() {
|
||||
|
||||
counterMoves.fill(MOVE_NONE);
|
||||
@@ -80,8 +77,7 @@ void Thread::clear() {
|
||||
}
|
||||
|
||||
|
||||
// Thread::start_searching() wakes up the thread that will start the search
|
||||
|
||||
// Wakes up the thread that will start the search
|
||||
void Thread::start_searching() {
|
||||
mutex.lock();
|
||||
searching = true;
|
||||
@@ -90,9 +86,8 @@ void Thread::start_searching() {
|
||||
}
|
||||
|
||||
|
||||
// Thread::wait_for_search_finished() blocks on the condition variable
|
||||
// Blocks on the condition variable
|
||||
// until the thread has finished searching.
|
||||
|
||||
void Thread::wait_for_search_finished() {
|
||||
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
@@ -100,7 +95,7 @@ void Thread::wait_for_search_finished() {
|
||||
}
|
||||
|
||||
|
||||
// Thread::idle_loop() is where the thread is parked, blocked on the
|
||||
// Thread gets parked here, blocked on the
|
||||
// condition variable, when it has no work to do.
|
||||
|
||||
void Thread::idle_loop() {
|
||||
@@ -129,10 +124,9 @@ void Thread::idle_loop() {
|
||||
}
|
||||
}
|
||||
|
||||
// ThreadPool::set() creates/destroys threads to match the requested number.
|
||||
// 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) {
|
||||
|
||||
if (threads.size() > 0) // destroy any existing thread(s)
|
||||
@@ -160,8 +154,7 @@ void ThreadPool::set(size_t requested) {
|
||||
}
|
||||
|
||||
|
||||
// ThreadPool::clear() sets threadPool data to initial values
|
||||
|
||||
// Sets threadPool data to initial values
|
||||
void ThreadPool::clear() {
|
||||
|
||||
for (Thread* th : threads)
|
||||
@@ -174,9 +167,8 @@ void ThreadPool::clear() {
|
||||
}
|
||||
|
||||
|
||||
// ThreadPool::start_thinking() wakes up main thread waiting in idle_loop() and
|
||||
// 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,
|
||||
|
||||
Reference in New Issue
Block a user