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;
Limits = limits;
RootMoves.clear();
- for (MoveList<MV_LEGAL> ml(pos); !ml.end(); ++ml)
+ for (MoveList<LEGAL> ml(pos); !ml.end(); ++ml)
if (searchMoves.empty() || count(searchMoves.begin(), searchMoves.end(), ml.move()))
RootMoves.push_back(RootMove(ml.move()));