wakes up the disk io thread once a second to flush caches

This commit is contained in:
Arvid Norberg 2009-03-14 09:24:58 +00:00
parent f5f9796ba7
commit af10b55254
1 changed files with 7 additions and 1 deletions

View File

@ -1016,7 +1016,13 @@ namespace libtorrent
mutex_t::scoped_lock jl(m_queue_mutex);
while (m_jobs.empty() && !m_abort)
m_signal.wait(jl);
{
// if there hasn't been an event in one second
// see if we should flush the cache
if (!m_signal.timed_wait(jl, boost::get_system_time() + boost::posix_time::seconds(1)))
flush_expired_pieces();
}
if (m_abort && m_jobs.empty())
{
jl.unlock();