This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is reserved space for an absl::Mutex to guard flag data. It will be | |
// initialized in FlagImpl::Init via placement new. | |
// We can't use "absl::Mutex data_guard_", since this class is not literal. | |
// We do not want to use "absl::Mutex* data_guard_", since this would require | |
// heap allocation during initialization, which is both slows program startup | |
// and can fail. Using reserved space + placement new allows us to avoid both | |
// problems. | |
alignas(absl::Mutex) mutable char data_guard_[sizeof(absl::Mutex)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment