]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Retire push_button() and button_was_pressed()
[stockfish] / src / search.cpp
index a3567d91274b5362ad7972f93c4691a97ffed859..c5c8b839db343d9ec4396e2f74d759965465aa4c 100644 (file)
@@ -310,7 +310,7 @@ namespace {
   void extract_pv_from_tt(const Position& pos, Move bestMove, Move pv[]);
 
 #if !defined(_MSC_VER)
-  void *init_thread(void *threadID);
+  void* init_thread(void* threadID);
 #else
   DWORD WINAPI init_thread(LPVOID threadID);
 #endif
@@ -425,8 +425,11 @@ bool think(Position& pos, bool infinite, bool ponder, int time[], int increment[
 
   // Read UCI option values
   TT.set_size(get_option_value_int("Hash"));
-  if (button_was_pressed("Clear Hash"))
+  if (get_option_value_bool("Clear Hash"))
+  {
+      set_option_value("Clear Hash", "false");
       TT.clear();
+  }
 
   CheckExtension[1]         = Depth(get_option_value_int("Check Extension (PV nodes)"));
   CheckExtension[0]         = Depth(get_option_value_int("Check Extension (non-PV nodes)"));
@@ -2144,7 +2147,7 @@ split_point_start: // At split points actual search starts from here
 
 #if !defined(_MSC_VER)
 
-  void* init_thread(void *threadID) {
+  void* init_thread(voidthreadID) {
 
     ThreadsMgr.idle_loop(*(int*)threadID, NULL);
     return NULL;
@@ -2264,7 +2267,7 @@ split_point_start: // At split points actual search starts from here
 
   void ThreadsManager::init_threads() {
 
-    volatile int i;
+    int i, arg[MAX_THREADS];
     bool ok;
 
     // Initialize global locks
@@ -2292,15 +2295,15 @@ split_point_start: // At split points actual search starts from here
     // Launch the helper threads
     for (i = 1; i < MAX_THREADS; i++)
     {
+        arg[i] = i;
 
 #if !defined(_MSC_VER)
         pthread_t pthread[1];
-        ok = (pthread_create(pthread, NULL, init_thread, (void*)(&i)) == 0);
+        ok = (pthread_create(pthread, NULL, init_thread, (void*)(&arg[i])) == 0);
         pthread_detach(pthread[0]);
 #else
-        ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&i), 0, NULL) != NULL);
+        ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&arg[i]), 0, NULL) != NULL);
 #endif
-
         if (!ok)
         {
             cout << "Failed to create thread number " << i << endl;