title: Implementing multi-threading in an already existing chess engine in C
body: <p>I want to know if its possible to modify an existing chess engine in C that works without multi-threading to be able to support multi-threading. I have no experience in this subject and would appreciate some guidance.</p>
  
  <p>EDIT: To be more specific, is there anything I can add to my implementation of negamax to make it multi-thread compatible? :</p>
  
  <pre><code>static double alphaBetaMax(double alpha, double beta, int depthleft, game_t game, bool player)
  {
      move_t *cur;
      move_t *tmp;
      double score = 0;
      bool did_move = false;
  
      cur = getAllMoves(game, player);
      if(cur == NULL) /*/ check mate*/
          return -9999999*(player*2-1);
      tmp = firstMove;
      firstMove = 0;
  
      while (cur != NULL)
      {
          game_t copy;
          if(depthleft&lt;=0 &amp;&amp; !isCapture(game, cur)) { /* Quiescence search */
              cur = cur-&gt;next;
              continue;
          }
          did_move = true;
          copyGame(game, &amp;copy);
          makeMove(&amp;copy, *cur);
          firstMove = NULL;
          score = -alphaBetaMax(-beta, -alpha, depthleft - 1, copy, !player);
          if(board_count &gt; MAX_BOARDS)
              break;
  
          freeGame(copy);
          if(score &gt; alpha)
          alpha = score;
  
          if (beta &lt;= alpha)
              break;
          cur = cur-&gt;next;
      }
      firstMove=tmp;
      freeMoves();
  
      if(!did_move)
          alpha = evaluate(game)*(player*2-1);
      return alpha;
  }
  </code></pre>