1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Rename flag 'stop' in 'stopRequest'

Instead of other flags this is not a state flag, i.e. does
not defines a state for the thread, but a request because
after we raise 'stopRequest' flag the corresponding thread is
not stopped, but continues to run for a while until it returns
from sp_search() in idle_loop.

It is important the name reflects this.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-02-14 16:04:53 +01:00
parent 40a7ffd53f
commit b29198354c
2 changed files with 8 additions and 8 deletions

View file

@ -70,7 +70,7 @@ namespace {
int active_threads() const { return ActiveThreads; } int active_threads() const { return ActiveThreads; }
void set_active_threads(int newActiveThreads) { ActiveThreads = newActiveThreads; } void set_active_threads(int newActiveThreads) { ActiveThreads = newActiveThreads; }
void set_stop_request(int threadID) { threads[threadID].stop = true; } void set_stop_request(int threadID) { threads[threadID].stopRequest = true; }
void incrementNodeCounter(int threadID) { threads[threadID].nodes++; } void incrementNodeCounter(int threadID) { threads[threadID].nodes++; }
void incrementBetaCounter(Color us, Depth d, int threadID) { threads[threadID].betaCutOffs[us] += unsigned(d); } void incrementBetaCounter(Color us, Depth d, int threadID) { threads[threadID].betaCutOffs[us] += unsigned(d); }
void print_current_line(SearchStack ss[], int ply, int threadID); void print_current_line(SearchStack ss[], int ply, int threadID);
@ -2752,7 +2752,7 @@ namespace {
AllThreadsShouldExit = true; AllThreadsShouldExit = true;
for (int i = 1; i < THREAD_MAX; i++) for (int i = 1; i < THREAD_MAX; i++)
{ {
threads[i].stop = true; threads[i].stopRequest = true;
while (threads[i].running); while (threads[i].running);
} }
@ -2774,7 +2774,7 @@ namespace {
SplitPoint* sp; SplitPoint* sp;
if (threads[threadID].stop) if (threads[threadID].stopRequest)
return true; return true;
if (ActiveThreads <= 2) if (ActiveThreads <= 2)
@ -2905,7 +2905,7 @@ namespace {
splitPoint->slaves[i] = 0; splitPoint->slaves[i] = 0;
threads[master].idle = false; threads[master].idle = false;
threads[master].stop = false; threads[master].stopRequest = false;
threads[master].splitPoint = splitPoint; threads[master].splitPoint = splitPoint;
// Allocate available threads setting idle flag to false // Allocate available threads setting idle flag to false
@ -2913,7 +2913,7 @@ namespace {
if (thread_is_available(i, master)) if (thread_is_available(i, master))
{ {
threads[i].idle = false; threads[i].idle = false;
threads[i].stop = false; threads[i].stopRequest = false;
threads[i].splitPoint = splitPoint; threads[i].splitPoint = splitPoint;
splitPoint->slaves[i] = 1; splitPoint->slaves[i] = 1;
splitPoint->cpus++; splitPoint->cpus++;
@ -2950,7 +2950,7 @@ namespace {
*beta = splitPoint->beta; *beta = splitPoint->beta;
*bestValue = splitPoint->bestValue; *bestValue = splitPoint->bestValue;
threads[master].stop = false; threads[master].stopRequest = false;
threads[master].idle = false; threads[master].idle = false;
threads[master].activeSplitPoints--; threads[master].activeSplitPoints--;
threads[master].splitPoint = splitPoint->parent; threads[master].splitPoint = splitPoint->parent;
@ -3017,7 +3017,7 @@ namespace {
assert(!threads[i].workIsWaiting); assert(!threads[i].workIsWaiting);
// These two flags can be in a random state // These two flags can be in a random state
threads[i].stop = threads[i].printCurrentLineRequest = false; threads[i].stopRequest = threads[i].printCurrentLineRequest = false;
} }
} }

View file

@ -70,7 +70,7 @@ struct Thread {
volatile int activeSplitPoints; volatile int activeSplitPoints;
uint64_t nodes; uint64_t nodes;
uint64_t betaCutOffs[2]; uint64_t betaCutOffs[2];
volatile bool stop; volatile bool stopRequest;
volatile bool running; volatile bool running;
volatile bool idle; volatile bool idle;
volatile bool sleeping; volatile bool sleeping;