Apply clang-tidy feedback

This commit is contained in:
Tyler Neely 2022-12-01 16:26:41 +00:00
parent cdde7ca670
commit 438b519703
2 changed files with 8 additions and 5 deletions

View File

@ -11,6 +11,10 @@
#pragma once
#include <condition_variable>
#include <mutex>
#include <vector>
namespace memgraph::io {
class ReadinessToken {
@ -30,7 +34,6 @@ class Inner {
void Notify(ReadinessToken readiness_token) {
{
std::unique_lock<std::mutex> lock(mu_);
spdlog::trace("Notifier notifying token {}", readiness_token.GetId());
ready_.emplace_back(readiness_token);
} // mutex dropped
@ -61,9 +64,9 @@ class Notifier {
Notifier &operator=(Notifier &&old) = default;
~Notifier() = default;
void Notify(ReadinessToken readiness_token) { inner_->Notify(readiness_token); }
void Notify(ReadinessToken readiness_token) const { inner_->Notify(readiness_token); }
ReadinessToken Await() { return inner_->Await(); }
ReadinessToken Await() const { return inner_->Await(); }
};
} // namespace memgraph::io

View File

@ -107,7 +107,7 @@ class Io {
ReadinessToken readiness_token) {
const Duration timeout = default_timeout_;
const Address from_address = address_;
std::function<void()> fill_notifier = std::bind(&Notifier::Notify, notifier, readiness_token);
std::function<void()> fill_notifier = [notifier, readiness_token]() { notifier.Notify(readiness_token); };
return implementation_.template Request<RequestT, ResponseT>(to_address, from_address, std::move(request),
fill_notifier, timeout);
}
@ -117,7 +117,7 @@ class Io {
ResponseFuture<ResponseT> RequestWithNotificationAndTimeout(Address to_address, RequestT request, Notifier notifier,
ReadinessToken readiness_token, Duration timeout) {
const Address from_address = address_;
std::function<void()> fill_notifier = std::bind(&Notifier::Notify, notifier, readiness_token);
std::function<void()> fill_notifier = [notifier, readiness_token]() { notifier.Notify(readiness_token); };
return implementation_.template Request<RequestT, ResponseT>(to_address, from_address, std::move(request),
fill_notifier, timeout);
}