static IndexReaderPtr refreshReader(IndexReaderPtr reader)
{
    IndexReaderPtr oldReader = reader;
    reader = reader->reopen();
    if (reader != oldReader)
        oldReader->close();
    return reader;
}
示例#2
0
IndexReaderPtr TranslationMemoryImpl::Reader()
{
    std::lock_guard<std::mutex> guard(m_readerMutex);
    if ( m_reader )
        m_reader = m_reader->reopen();
    else
        m_reader = IndexReader::open(m_dir, true);
    return m_reader;
}