// close_egtb() closes/frees tablebases if necessary
void close_egtb()
{
  if  (TbSize != 0)
  {
      tbcache_done();
      tb_done();
      paths = tbpaths_done(paths);
      TbSize = 0;
  }
}
Beispiel #2
0
bool GTB::load() {
    if (path.size() == 0)return false;
    memset(installedPieces, 0, sizeof(installedPieces));
    if (!FileUtil::fileExists(path)) {
        cout << "file not found " << path << endl;
        return false;
    }
    tbstats_reset();
    paths = tbpaths_done(paths);
    paths = tbpaths_init();
    _assert(paths);
    paths = tbpaths_add(paths, path.c_str());
    restart();
    unsigned av = tb_availability();
    if (0 != (av & 2)) {
        setInstalledPieces(3);
        cout << "3-pc TBs complete\n";
    } else if (0 != (av & 1)) {
        cout << "Some 3-pc TBs available\n";
    } else {
        cout << "No 3-pc TBs available\n";
    }
    if (0 != (av & 8)) {
        setInstalledPieces(4);
        cout << "4-pc TBs complete\n";
    } else if (0 != (av & 4)) {
        cout << "Some 4-pc TBs available\n";
    } else {
        cout << "No 4-pc TBs available\n";
    }
    if (0 != (av & 32)) {
        setInstalledPieces(5);
        cout << "5-pc TBs complete\n";
    } else if (0 != (av & 16)) {
        cout << "Some 5-pc TBs available\n";
    } else {
        cout << "No 5-pc TBs available\n";
    }
    cout << endl;
    if (!getAvailable()) {
        return false;
    }
    setCacheSize(cacheSize);
    tb_init(verbosity, scheme, paths);
    tbcache_init(cacheSize * 1024 * 1024, wdl_fraction);
    tbstats_reset();
    return true;
}
Beispiel #3
0
/*
 * Unload all tablebases and destroy the thread used for probing
 * during search.
 */
void unload_gtb(void)
{
    if (!tb_is_initialized()) return;
    tbcache_done();
    tb_done();
    tb_paths = tbpaths_done(tb_paths);
    worker_quit = true;
    worker_task_ready = true;
#ifdef WINDOWS_THREADS
    while (worker_quit) Sleep(1);
    CloseHandle(worker_mutex);
    CloseHandle(worker_thread);
#else
    while (worker_quit) usleep(100);
    pthread_mutex_destroy(&worker_mutex);
#endif
}
Beispiel #4
0
Tablebase::~Tablebase() {
    tbcache_done();
    tb_done();
    paths = tbpaths_done(paths);
}
Beispiel #5
0
void GaviotaTb::freeTB() {
    tbcache_done();
    tb_done();
    paths = tbpaths_done(paths);
}
Beispiel #6
0
void gtb_clear()
{ tbcache_done();
  tb_done();
  tbpaths_done(gtb_paths);
}
Beispiel #7
0
GTB::~GTB() {
    tbcache_done();
    tb_done();
    paths = tbpaths_done(paths);
}