+ }
+
+ if (bestSp)
+ {
+ sp = bestSp;
+
+ // Recheck the conditions under lock protection
+ Threads.spinlock.acquire();
+ sp->spinlock.acquire();
+
+ if ( sp->allSlavesSearching
+ && sp->slavesMask.count() < MAX_SLAVES_PER_SPLITPOINT
+ && can_join(sp))
+ {
+ sp->slavesMask.set(idx);
+ activeSplitPoint = sp;
+ searching = true;
+ }
+
+ sp->spinlock.release();
+ Threads.spinlock.release();
+ }