From 1f43d7514387b4585b9a4e0ffac361a03d593e5e Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Fri, 10 Apr 2015 17:05:14 +0200 Subject: Creating new events until file is completely loaded. --- src/cachemanager.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cachemanager.cc b/src/cachemanager.cc index 0ca8bb0..c035703 100644 --- a/src/cachemanager.cc +++ b/src/cachemanager.cc @@ -28,6 +28,8 @@ #include +#define CHUNKSIZE 256 + CacheManager::CacheManager() { } @@ -99,7 +101,7 @@ sample_t *CacheManager::next(cacheid_t id, size_t &size) MutexAutolock l(m_caches); c = &id2cache[id]; } - size = 256; + size = CHUNKSIZE; sample_t *s = c->file->data + c->pos; c->pos += size; return s; @@ -107,16 +109,18 @@ sample_t *CacheManager::next(cacheid_t id, size_t &size) void CacheManager::loadNext(cacheid_t id) { -/* - printf("Loading next...\n"); + m_caches.lock(); + cache_t c = id2cache[id]; + c.pos += CHUNKSIZE; + id2cache[id] = c; + m_caches.unlock(); // If more is left of file - if(false) { + if(c.pos < c.file->size) { event_t e; e.id = id; pushEvent(e); } -*/ } void CacheManager::thread_main() -- cgit v1.2.3