Skip to content

Commit

Permalink
PS-9621: Initialization of std::atomic_flag caller_active_ in Percona…
Browse files Browse the repository at this point in the history
… Telemetry component is not compliant with the standard

https://perconadev.atlassian.net/browse/PS-9621

Initialization of std::atomic_flag in the constructor's initializer
list is not compliant with the standard. Gcc allows it, however clang
issues a compilation warning which turns into error in maintainer mode
build.
(error: braces around scalar initializer [-Werror,-Wbraced-scalar-init])
  • Loading branch information
kamil-holubicki committed Jan 7, 2025
1 parent f01c613 commit d80dd85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions components/percona_telemetry/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Worker::Worker(Config &config, Storage &storage, DataProvider &data_provider,
storage_(storage),
data_provider_(data_provider),
logger_(logger),
stop_worker_thd_(false),
caller_active_(ATOMIC_FLAG_INIT) {}
stop_worker_thd_(false) {}

bool Worker::start() {
std::thread thd(&Worker::worker_thd_fn, this);
Expand Down
2 changes: 1 addition & 1 deletion components/percona_telemetry/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Worker {
DataProvider &data_provider_;
Logger &logger_;
std::atomic_bool stop_worker_thd_;
std::atomic_flag caller_active_;
std::atomic_flag caller_active_ = ATOMIC_FLAG_INIT;
std::condition_variable cv_;

std::thread thd_;
Expand Down

0 comments on commit d80dd85

Please sign in to comment.