Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 1 | From b626703de7ece507f360507e49d3ecb448b12e07 Mon Sep 17 00:00:00 2001 |
| 2 | From: Maysam Yabandeh <myabandeh@fb.com> |
| 3 | Date: Thu, 12 Dec 2019 13:48:50 -0800 |
| 4 | Subject: [PATCH] Fix build breakage from lock_guard error (#6161) |
| 5 | |
| 6 | Summary: |
| 7 | This change fixes a source issue that caused compile time error which breaks build for many fbcode services in that setup. The size() member function of channel is a const member, so member variables accessed within it are implicitly const as well. This caused error when clang fails to resolve to a constructor that takes std::mutex because the suitable constructor got rejected due to loss of constness for its argument. The fix is to add mutable modifier to the lock_ member of channel. |
| 8 | Pull Request resolved: https://github.com/facebook/rocksdb/pull/6161 |
| 9 | |
| 10 | Differential Revision: D18967685 |
| 11 | |
| 12 | Pulled By: maysamyabandeh |
| 13 | |
| 14 | Upstream-Status: Backport |
| 15 | |
| 16 | fbshipit-source-id: 698b6a5153c3c92eeacb842c467aa28cc350d432 |
| 17 | --- |
| 18 | util/channel.h | 2 +- |
| 19 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 20 | |
| 21 | diff --git a/util/channel.h b/util/channel.h |
| 22 | index 0225482c0..a8a47680a 100644 |
| 23 | --- a/util/channel.h |
| 24 | +++ b/util/channel.h |
| 25 | @@ -60,7 +60,7 @@ class channel { |
| 26 | |
| 27 | private: |
| 28 | std::condition_variable cv_; |
| 29 | - std::mutex lock_; |
| 30 | + mutable std::mutex lock_; |
| 31 | std::queue<T> buffer_; |
| 32 | bool eof_; |
| 33 | }; |
| 34 | -- |
| 35 | 2.24.1 |
| 36 | |