fix compilation error

GitOrigin-RevId: 20b5add31a628fd040e1f20c103d330dfa3c7652
This commit is contained in:
Arseny Smirnov 2019-01-24 18:01:02 +04:00
parent 2edc069583
commit c087b4bb6e
3 changed files with 5 additions and 10 deletions

View File

@ -20,7 +20,7 @@ class HazardPointers {
explicit HazardPointers(size_t threads_n) : threads_(threads_n) { explicit HazardPointers(size_t threads_n) : threads_(threads_n) {
for (auto &data : threads_) { for (auto &data : threads_) {
for (auto &ptr : data.hazard) { for (auto &ptr : data.hazard) {
std::atomic_init(&ptr, nullptr); std::atomic_init(&ptr, static_cast<T *>(nullptr));
} }
} }
} }

View File

@ -100,15 +100,7 @@ BufferRaw *BufferAllocator::create_buffer_raw(size_t size) {
} }
buffer_mem += buf_size; buffer_mem += buf_size;
auto *buffer_raw = reinterpret_cast<BufferRaw *>(new char[buf_size]); auto *buffer_raw = reinterpret_cast<BufferRaw *>(new char[buf_size]);
new (buffer_raw) BufferRaw(); return new (buffer_raw) BufferRaw(size);
buffer_raw->data_size_ = size;
buffer_raw->begin_ = 0;
std::atomic_init(&buffer_raw->end_, 0);
std::atomic_init(&buffer_raw->ref_cnt_, 1);
std::atomic_init(&buffer_raw->has_writer_, true);
buffer_raw->was_reader_ = false;
return buffer_raw;
} }
void BufferBuilder::append(BufferSlice slice) { void BufferBuilder::append(BufferSlice slice) {

View File

@ -20,6 +20,9 @@
namespace td { namespace td {
struct BufferRaw { struct BufferRaw {
explicit BufferRaw(size_t size)
: data_size_(size), begin_(0), end_(0), ref_cnt_(1), has_writer_(true), was_reader_(false) {
}
size_t data_size_; size_t data_size_;
// Constant after first reader is created. // Constant after first reader is created.