From 34d7570a34c0daec5ca9c705296470b31d743d91 Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Mon, 11 Jul 2022 20:13:04 +0800 Subject: [PATCH] delete copy/move ctor of MPMCQueue explicitly (#5328) close pingcap/tiflash#5329 --- dbms/src/Common/MPMCQueue.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dbms/src/Common/MPMCQueue.h b/dbms/src/Common/MPMCQueue.h index 31dfc65a174..e005c363eae 100644 --- a/dbms/src/Common/MPMCQueue.h +++ b/dbms/src/Common/MPMCQueue.h @@ -15,6 +15,7 @@ #pragma once #include +#include #include #include @@ -74,6 +75,11 @@ class MPMCQueue destruct(getObj(read_pos)); } + // Cannot to use copy/move constructor, + // because MPMCQueue maybe used by different threads. + // Copy and move it is dangerous. + DISALLOW_COPY_AND_MOVE(MPMCQueue); + /// Block until: /// 1. Pop succeeds with a valid T: return true. /// 2. The queue is cancelled or finished: return false.