// Try to late join to another split point if none of its slaves has
// already finished.
SplitPoint* bestSp = NULL;
- int bestThread = 0;
+ Thread* bestThread = NULL;
int bestScore = INT_MAX;
for (size_t i = 0; i < Threads.size(); ++i)
&& sp->slavesCount < MAX_SLAVES_PER_SPLITPOINT
&& available_to(Threads[i]))
{
+ assert(this != Threads[i]);
+ assert(!(this_sp && this_sp->slavesMask.none()));
+
// Compute the recursive split points chain size
int level = -1;
for (SplitPoint* spp = Threads[i]->activeSplitPoint; spp; spp = spp->parentSplitPoint)
if (score < bestScore)
{
bestSp = sp;
- bestThread = i;
+ bestThread = Threads[i];
bestScore = score;
}
}
if ( sp->allSlavesSearching
&& sp->slavesCount < MAX_SLAVES_PER_SPLITPOINT
- && available_to(Threads[bestThread]))
+ && available_to(bestThread))
{
sp->slavesMask.set(idx);
sp->slavesCount++;