Skip to content

Commit 1e7e144

Browse files
committed
fix grpc: std::shared_mutex -> engine::SharedMutex
Tests: CI commit_hash:521fc46eb70ee1b177c56a29eed55fef057d6dbb
1 parent 3f80f94 commit 1e7e144

File tree

3 files changed

+51
-50
lines changed

3 files changed

+51
-50
lines changed

grpc/include/userver/ugrpc/protobuf_visit.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
/// @brief Utilities for visiting the fields of protobufs
55

66
#include <mutex>
7-
#include <shared_mutex>
87
#include <string_view>
98
#include <vector>
109

1110
#include <google/protobuf/message.h>
1211

12+
#include <userver/engine/shared_mutex.hpp>
1313
#include <userver/utils/assert.hpp>
1414
#include <userver/utils/function_ref.hpp>
1515
#include <userver/utils/impl/internal_tag.hpp>
@@ -136,10 +136,10 @@ class VisitorCompiler {
136136
~VisitorCompiler() = default;
137137

138138
/// @brief Lock the visitor for read
139-
std::shared_lock<std::shared_mutex> LockRead();
139+
std::shared_lock<engine::SharedMutex> LockRead();
140140

141141
/// @brief Lock the visitor for write
142-
std::unique_lock<std::shared_mutex> LockWrite();
142+
std::unique_lock<engine::SharedMutex> LockWrite();
143143

144144
const Dependencies& GetFieldsWithSelectedChildren() const { return fields_with_selected_children_; }
145145
/// @endcond
@@ -157,7 +157,7 @@ class VisitorCompiler {
157157
/// @brief Propagate the selection information upwards
158158
void PropagateSelected(const google::protobuf::Descriptor* descriptor);
159159

160-
std::shared_mutex mutex_;
160+
engine::SharedMutex mutex_;
161161
const LockBehavior lock_behavior_;
162162

163163
Dependencies fields_with_selected_children_;

grpc/src/ugrpc/protobuf_visit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,13 @@ bool VisitorCompiler::ContainsSelected(const google::protobuf::Descriptor* descr
239239
IsSelected(*descriptor);
240240
}
241241

242-
std::shared_lock<std::shared_mutex> VisitorCompiler::LockRead() {
242+
std::shared_lock<engine::SharedMutex> VisitorCompiler::LockRead() {
243243
std::shared_lock read_lock(mutex_, std::defer_lock);
244244
if (lock_behavior_ == LockBehavior::kShared) read_lock.lock();
245245
return read_lock;
246246
}
247247

248-
std::unique_lock<std::shared_mutex> VisitorCompiler::LockWrite() {
248+
std::unique_lock<engine::SharedMutex> VisitorCompiler::LockWrite() {
249249
std::unique_lock write_lock(mutex_, std::defer_lock);
250250
if (lock_behavior_ == LockBehavior::kShared) write_lock.lock();
251251
return write_lock;

0 commit comments

Comments
 (0)