- SplitPoint* tsp = splitPoint;
- Position pos(*tsp->pos, threadID);
-
- memcpy(ss, tsp->ss - 1, 4 * sizeof(Stack));
- (ss+1)->sp = tsp;
-
- if (tsp->nodeType == Root)
- search<SplitPointRoot>(pos, ss+1, tsp->alpha, tsp->beta, tsp->depth);
- else if (tsp->nodeType == PV)
- search<SplitPointPV>(pos, ss+1, tsp->alpha, tsp->beta, tsp->depth);
- else if (tsp->nodeType == NonPV)
- search<SplitPointNonPV>(pos, ss+1, tsp->alpha, tsp->beta, tsp->depth);
+ Position pos(*sp->pos, this);
+
+ memcpy(ss, sp->ss - 1, 4 * sizeof(Stack));
+ (ss+1)->sp = sp;
+
+ lock_grab(sp->lock);
+
+ if (sp->nodeType == Root)
+ search<SplitPointRoot>(pos, ss+1, sp->alpha, sp->beta, sp->depth);
+ else if (sp->nodeType == PV)
+ search<SplitPointPV>(pos, ss+1, sp->alpha, sp->beta, sp->depth);
+ else if (sp->nodeType == NonPV)
+ search<SplitPointNonPV>(pos, ss+1, sp->alpha, sp->beta, sp->depth);