File tree Expand file tree Collapse file tree 3 files changed +51
-50
lines changed Expand file tree Collapse file tree 3 files changed +51
-50
lines changed Original file line number Diff line number Diff line change 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_;
Original file line number Diff line number Diff 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;
You can’t perform that action at this time.
0 commit comments