+ // Copy the tail of current search stack to the master thread
+ memcpy(splitPoint->sstack[master] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
+
+ // Tell the threads that they have work to do. This will make them leave
+ // their idle loop. Also copy search stack tail for each slave thread.
+ for (int i = 0; i < ActiveThreads; i++)
+ {
+ if (splitPoint->slaves[i])
+ memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
+
+ if (i == master || splitPoint->slaves[i])
+ {
+ Threads[i].stop = false;
+ Threads[i].workIsWaiting = true; // This makes the slave to exit from idle_loop()
+ }
+ }
+
+ // Everything is set up. The master thread enters the idle loop, from