Browse Source

Cache

segfaults
Pjotr Prins 3 years ago
parent
commit
fd1e8281f1
  1. 2
      bio/core/bgzf/block.d
  2. 10
      bio/core/bgzf/inputstream.d

2
bio/core/bgzf/block.d

@ -108,7 +108,7 @@ struct DecompressedBgzfBlock {
}
///
// alias Cache!(BgzfBlock, DecompressedBgzfBlock) BgzfBlockCache;
alias Cache!(BgzfBlock, DecompressedBgzfBlock) BgzfBlockCache;
/// Function for BGZF block decompression.
/// Reuses buffer allocated for storing compressed data,

10
bio/core/bgzf/inputstream.d

@ -336,6 +336,7 @@ class StreamChunksSupplier : BgzfBlockSupplier {
}
///
// Provided an uncompressed stream block by class
class BgzfInputStream : Stream {
private {
BgzfBlockSupplier _supplier;
@ -373,6 +374,7 @@ class BgzfInputStream : Stream {
size_t _offset;
bool fillNextBlock() {
// Sets up a decompression task and pushes it on the roundbuf _tasks
ubyte* p = _data.ptr + _offset;
BlockAux b = void;
if (_supplier.getNextBgzfBlock(&b.block, p,
@ -388,6 +390,7 @@ class BgzfInputStream : Stream {
stderr.writeln("[creating task] ", b.block.start_offset, " / ", b.skip_start, " / ", b.skip_end);
}
/*
DecompressionTask tmp = void;
tmp = scopedTask!decompressBgzfBlock(b.block);
auto t = _task_buf.ptr + _offset / _max_block_size;
@ -396,7 +399,12 @@ class BgzfInputStream : Stream {
b.task = t;
_tasks.put(b);
_pool.put(b.task);
*/
// tmp = scopedTask!decompressBgzfBlock(b.block);
auto task = task!decompressBgzfBlock(b.block);
b.task = task;
_tasks.put(b); // _tasks is roundbuf
_pool.put(b.task); // _pool is thread pool
_offset += _max_block_size;
if (_offset == _data.length)
_offset = 0;

Loading…
Cancel
Save