Commit 74fc29c5 authored by dagal's avatar dagal
Browse files

Merge remote-tracking branch 'origin/master'

parents 4ae7a358 19e75a57
......@@ -72,17 +72,22 @@ ZSTDArray::ZSTDArray(const std::vector< std::vector<uint32_t> > *initialTimes, c
check(initialTimes);
std::cerr << "OK" << std::endl;
#endif
assert(pthread_mutex_init(&d_stream_lock, NULL) == 0);
}
ZSTDArray::~ZSTDArray() {
pthread_mutex_destroy(&d_stream_lock);
ZSTD_freeDStream(d_stream);
}
const void inline ZSTDArray::decompressFrame(ZSTD_outBuffer* output, ZSTD_inBuffer* input) {
output->pos = 0;
pthread_mutex_lock(&d_stream_lock);
ZSTD_initDStream(d_stream);
const auto zsize = ZSTD_decompressStream(d_stream, output, input);
assert(!ZSTD_isError((zsize)));
pthread_mutex_unlock(&d_stream_lock);
}
const size_t ZSTDArray::getSize() {
......
......@@ -7,7 +7,7 @@
#include <iostream>
#include <exception>
#include <algorithm>
#include <pthread.h>
#include <zstd.h>
#include <assert.h>
......@@ -21,6 +21,7 @@ class ZSTDArray {
std::vector<uint32_t> lines_C;
std::vector< std::vector<uint32_t> > lines_D;
ZSTD_DStream * d_stream = ZSTD_createDStream();
pthread_mutex_t d_stream_lock;
const void decompressFrame(ZSTD_outBuffer* output, ZSTD_inBuffer* input);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment