Skip to content

Commit

Permalink
Fix build breakage from lock_guard error (#6161)
Browse files Browse the repository at this point in the history
Summary:
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.
Pull Request resolved: #6161

Differential Revision: D18967685

Pulled By: maysamyabandeh

fbshipit-source-id: 698b6a5153c3c92eeacb842c467aa28cc350d432
  • Loading branch information
maysamyabandeh authored and facebook-github-bot committed Dec 12, 2019
1 parent b433bbe commit a796c06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/channel.h
Expand Up @@ -60,7 +60,7 @@ class channel {

private:
std::condition_variable cv_;
std::mutex lock_;
mutable std::mutex lock_;
std::queue<T> buffer_;
bool eof_;
};
Expand Down

0 comments on commit a796c06

Please sign in to comment.