X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=eb038d0a8e507f8d8101cc4c1ef31c8de6d2685c;hp=13f333d9fc5a95511f133ee15f5d0a681e095f16;hb=8286e6ded2f2c6c9d48b317f077a8462d4b1f26e;hpb=57340c109b0ddd8764bf73dfa3bfe2bbe7928b59 diff --git a/src/search.cpp b/src/search.cpp index 13f333d9..eb038d0a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1440,7 +1440,7 @@ namespace { // Loop through all legal moves until no moves remain or a beta cutoff occurs // Initialize a MovePicker object for the current position - MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]); + MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply], beta); CheckInfo ci(pos); while ( bestValue < beta @@ -2593,7 +2593,7 @@ namespace { DWORD WINAPI init_thread(LPVOID threadID) { TM.idle_loop(*(int*)threadID, NULL); - return NULL; + return 0; } #endif @@ -2759,8 +2759,7 @@ namespace { #if !defined(_MSC_VER) ok = (pthread_create(pthread, NULL, init_thread, (void*)(&i)) == 0); #else - DWORD iID[1]; - ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&i), 0, iID) != NULL); + ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&i), 0, NULL) != NULL); #endif if (!ok) @@ -2768,6 +2767,9 @@ namespace { cout << "Failed to create thread number " << i << endl; Application::exit_with_failure(); } + + // Wait until the thread has finished launching and is gone to sleep + while (threads[i].state != THREAD_SLEEPING); } }