summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2015-04-10 17:05:14 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-01-20 13:22:08 +0100
commit651ea5b2245648077f70ce5c5985beb748e20614 (patch)
tree58d447e983fe526974e87e35cc8157c1baee4ce2
parentdd36367658a537e56c29ccd9ca01babeac42a91c (diff)
Creating new events until file is completely loaded.
-rw-r--r--src/cachemanager.cc14
1 files changed, 9 insertions, 5 deletions
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 <stdio.h>
+#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()