This is an automated email from the ASF dual-hosted git repository. guangmingchen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push: new 216aa59c Fix : ELEMENTS_PER_BLOCK may be incorrect (#2562) 216aa59c is described below commit 216aa59c0bfa30957ff443e473762e05d7149275 Author: shanhe72101 <137591095+shanhe72...@users.noreply.github.com> AuthorDate: Wed Mar 13 10:21:03 2024 +0800 Fix : ELEMENTS_PER_BLOCK may be incorrect (#2562) * fix bug ELEMENTS_PER_BLOCK in doubly_buffered_data.h * fix bug ELEMENTS_PER_BLOCK in doubly_buffered_data.h * fix bug ELEMENTS_PER_BLOCK in doubly_buffered_data.h --- src/butil/containers/doubly_buffered_data.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/butil/containers/doubly_buffered_data.h b/src/butil/containers/doubly_buffered_data.h index e011d5da..62f67ead 100644 --- a/src/butil/containers/doubly_buffered_data.h +++ b/src/butil/containers/doubly_buffered_data.h @@ -253,7 +253,7 @@ template <typename T, typename TLS, bool AllowBthreadSuspended> class DoublyBufferedData<T, TLS, AllowBthreadSuspended>::WrapperTLSGroup { public: const static size_t RAW_BLOCK_SIZE = 4096; - const static size_t ELEMENTS_PER_BLOCK = (RAW_BLOCK_SIZE + sizeof(T) - 1) / sizeof(T); + const static size_t ELEMENTS_PER_BLOCK = RAW_BLOCK_SIZE / sizeof(Wrapper) > 0 ? RAW_BLOCK_SIZE / sizeof(Wrapper) : 1; struct BAIDU_CACHELINE_ALIGNMENT ThreadBlock { inline DoublyBufferedData::Wrapper* at(size_t offset) { @@ -359,7 +359,7 @@ __thread std::vector<typename DoublyBufferedData<T, TLS, AllowBthreadSuspended>: DoublyBufferedData<T, TLS, AllowBthreadSuspended>::WrapperTLSGroup::_s_tls_blocks = NULL; template <typename T, typename TLS, bool AllowBthreadSuspended> -class DoublyBufferedData<T, TLS, AllowBthreadSuspended>::Wrapper +class BAIDU_CACHELINE_ALIGNMENT DoublyBufferedData<T, TLS, AllowBthreadSuspended>::Wrapper : public DoublyBufferedDataWrapperBase<T, TLS> { friend class DoublyBufferedData; public: --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org