From e2cdcb24c35cdf8ff7981b332be44220218cded2 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Mon, 26 Nov 2018 18:15:07 +0800 Subject: [PATCH] still have bugs --- src/circ_elem_array.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/circ_elem_array.h b/src/circ_elem_array.h index ba97e30..e156488 100644 --- a/src/circ_elem_array.h +++ b/src/circ_elem_array.h @@ -52,15 +52,14 @@ public: static_assert(data_size % alignof(head_t) == 0, "data_size must be multiple of alignof(head_t)"); private: - byte_t block_[block_size]; - struct elem_t { head_t head_; byte_t data_[data_size]; }; + elem_t block_[elem_max]; elem_t* elem_start(void) { - return reinterpret_cast(block_); + return block_; } static elem_t* elem(void* ptr) { @@ -148,7 +147,7 @@ public: } while(!(cas = cr_.compare_exchange_weak(curr, next, std::memory_order_acq_rel)) && no_next); /* * if compare_exchange failed & !no_next, - * means there is another producer thread just update this commit, + * means there is another producer thread updated this commit, * so in this case we could just return */ if (no_next || (!cas/* && !no_next*/)) return;