Skip to content

Commit

Permalink
delete copy/move ctor of MPMCQueue explicitly
Browse files Browse the repository at this point in the history
Signed-off-by: guo-shaoge <[email protected]>
  • Loading branch information
guo-shaoge committed Jul 11, 2022
1 parent b62dc6a commit 340a3ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dbms/src/Common/MPMCQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ 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.
MPMCQueue(const MPMCQueue<T> &) = delete;
MPMCQueue(MPMCQueue<T> &&) = delete;
MPMCQueue<T> & operator=(const MPMCQueue<T> &) = delete;

/// Block until:
/// 1. Pop succeeds with a valid T: return true.
/// 2. The queue is cancelled or finished: return false.
Expand Down

0 comments on commit 340a3ab

Please sign in to comment.