From ca550f520219f8286301662d10b195301549baeb Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 8 Sep 2019 23:09:51 +0300 Subject: [PATCH] Fix MSVC 15.3 CE. GitOrigin-RevId: d049c35a3717374d6830555330b10ff6bac3bf1c --- tdutils/td/utils/EpochBasedMemoryReclamation.h | 8 ++++---- tdutils/td/utils/HazardPointers.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tdutils/td/utils/EpochBasedMemoryReclamation.h b/tdutils/td/utils/EpochBasedMemoryReclamation.h index ed93f2bf..acd4082a 100644 --- a/tdutils/td/utils/EpochBasedMemoryReclamation.h +++ b/tdutils/td/utils/EpochBasedMemoryReclamation.h @@ -95,13 +95,13 @@ class EpochBasedMemoryReclamation { static constexpr size_t MAX_BAGS = 3; struct ThreadData { std::atomic epoch{1}; - char pad[TD_CONCURRENCY_PAD - sizeof(epoch)]; + char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; size_t to_skip{0}; size_t checked_thread_i{0}; size_t bag_i{0}; std::vector> to_delete[MAX_BAGS]; - char pad2[TD_CONCURRENCY_PAD - sizeof(to_delete)]; + char pad2[TD_CONCURRENCY_PAD - sizeof(std::vector>) * MAX_BAGS]; void rotate_bags() { bag_i = (bag_i + 1) % MAX_BAGS; @@ -131,10 +131,10 @@ class EpochBasedMemoryReclamation { } }; std::vector threads_; - char pad[TD_CONCURRENCY_PAD - sizeof(threads_)]; + char pad[TD_CONCURRENCY_PAD - sizeof(std::vector)]; std::atomic epoch_{1}; - char pad2[TD_CONCURRENCY_PAD - sizeof(epoch_)]; + char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; void lock(size_t thread_id) { auto &data = threads_[thread_id]; diff --git a/tdutils/td/utils/HazardPointers.h b/tdutils/td/utils/HazardPointers.h index f4095dee..8c668b1f 100644 --- a/tdutils/td/utils/HazardPointers.h +++ b/tdutils/td/utils/HazardPointers.h @@ -97,14 +97,14 @@ class HazardPointers { private: struct ThreadData { std::array, MaxPointersN> hazard_; - char pad[TD_CONCURRENCY_PAD - sizeof(hazard_)]; + char pad[TD_CONCURRENCY_PAD - sizeof(std::array, MaxPointersN>)]; // stupid gc std::vector> to_delete_; - char pad2[TD_CONCURRENCY_PAD - sizeof(to_delete_)]; + char pad2[TD_CONCURRENCY_PAD - sizeof(std::vector>)]; }; std::vector threads_; - char pad2[TD_CONCURRENCY_PAD - sizeof(threads_)]; + char pad2[TD_CONCURRENCY_PAD - sizeof(std::vector)]; template static S *do_protect(std::atomic &hazard_ptr, std::atomic &to_protect) {