- for (int i = 0; i <= MAX_THREADS; i++)
- {
- lock_init(threads[i].sleepLock);
- cond_init(threads[i].sleepCond);
-
- for (int j = 0; j < MAX_ACTIVE_SPLIT_POINTS; j++)
- lock_init(threads[i].splitPoints[j].lock);
- }
-
- // Allocate main thread tables to call evaluate() also when not searching
- threads[0].pawnTable.init();
- threads[0].materialTable.init();
-
- // Create and launch all the threads, threads will go immediately to sleep
- for (int i = 0; i <= MAX_THREADS; i++)
- {
- threads[i].is_searching = false;
- threads[i].do_sleep = (i != 0); // Avoid a race with start_thinking()
- threads[i].threadID = i;
-
- if (!thread_create(threads[i].handle, start_routine, threads[i]))
- {
- std::cerr << "Failed to create thread number " << i << std::endl;
- ::exit(EXIT_FAILURE);
- }
- }
-}
+ maxThreadsPerSplitPoint = Options["Max Threads per Split Point"];
+ minimumSplitDepth = Options["Min Split Depth"] * ONE_PLY;
+ size_t requested = Options["Threads"];