lock_init(sleepLock);
cond_init(sleepCond);
- for (int j = 0; j < MAX_SPLITPOINTS_PER_THREAD; j++)
+ for (size_t j = 0; j < MAX_SPLITPOINTS_PER_THREAD; j++)
lock_init(splitPoints[j].lock);
if (!thread_create(handle, start_routine, this))
ThreadPool::~ThreadPool() {
- for (int i = 0; i < size(); i++)
+ for (size_t i = 0; i < size(); i++)
delete threads[i];
delete timer;
maxThreadsPerSplitPoint = Options["Max Threads per Split Point"];
minimumSplitDepth = Options["Min Split Depth"] * ONE_PLY;
useSleepingThreads = Options["Use Sleeping Threads"];
- int requested = Options["Threads"];
+ size_t requested = Options["Threads"];
assert(requested > 0);
void ThreadPool::wake_up() const {
- for (int i = 0; i < size(); i++)
+ for (size_t i = 0; i < size(); i++)
{
threads[i]->maxPly = 0;
threads[i]->do_sleep = false;
void ThreadPool::sleep() const {
- for (int i = 1; i < size(); i++) // Main thread will go to sleep by itself
+ for (size_t i = 1; i < size(); i++) // Main thread will go to sleep by itself
threads[i]->do_sleep = true; // to avoid a race with start_searching()
}
bool ThreadPool::available_slave_exists(Thread* master) const {
- for (int i = 0; i < size(); i++)
+ for (size_t i = 0; i < size(); i++)
if (threads[i]->is_available_to(master))
return true;
lock_grab(sp->lock);
lock_grab(splitLock);
- for (int i = 0; i < size() && !Fake; ++i)
+ for (size_t i = 0; i < size() && !Fake; ++i)
if (threads[i]->is_available_to(master))
{
sp->slavesMask |= 1ULL << i;
// Everything is set up. The master thread enters the idle loop, from which
// it will instantly launch a search, because its is_searching flag is set.
- // We pass the split point as a parameter to the idle loop, which means that
- // the thread will return from the idle loop when all slaves have finished
+ // The thread will return from the idle loop when all slaves have finished
// their work at this split point.
if (slavesCnt || Fake)
{
- master->idle_loop(sp);
+ master->idle_loop();
// In helpful master concept a master can help only a sub-tree of its split
// point, and because here is all finished is not possible master is booked.