void GoUctSearch::OnStartSearch() { SgUctSearch::OnStartSearch(); if (m_root != 0) { m_root->DeleteTree(); m_root = 0; } if (m_keepGames) { m_root = GoNodeUtil::CreateRoot(m_bd); if (LockFree()) SgWarning() << "GoUctSearch: keep games will be ignored" " in lock free search\n"; } m_toPlay = m_bd.ToPlay(); // Not needed if SetToPlay() was called for (SgBWIterator it; it; ++it) m_stones[*it] = m_bd.All(*it); int size = m_bd.Size(); // Limit to avoid very long games if m_simpleKo int maxGameLength = std::min(3 * size * size, GO_MAX_NUM_MOVES - m_bd.MoveNumber()); SetMaxGameLength(maxGameLength); m_boardHistory.SetFromBoard(m_bd); m_nextLiveGfx = m_liveGfxInterval; }
ThreadPool::~ThreadPool() { shutDown(); #ifdef _THREAD_TRACE LockFree(io_lock); #endif #ifndef _WIN32 if (pthread_attr_destroy(&stackSizeAttrib)) { perror("pthread_attr_destroy"); } #endif }
void GoUctSearch::OnSearchIteration(SgUctValue gameNumber, unsigned int threadId, const SgUctGameInfo& info) { SgUctSearch::OnSearchIteration(gameNumber, threadId, info); if (m_liveGfx != GOUCT_LIVEGFX_NONE && threadId == 0 && NeedLiveGfx(gameNumber)) { DisplayGfx(); } if (! LockFree() && m_root != 0) AppendGame(m_root, gameNumber, threadId, m_toPlay, info); }