@@ -57,7 +57,7 @@ void local_uds_client_endpoint_impl::restart(bool _force) {
5757 is_sending_ = false ;
5858 }
5959 {
60- std::lock_guard<std::mutex> its_lock (socket_mutex_);
60+ std::scoped_lock its_lock (socket_mutex_);
6161 shutdown_and_close_socket_unlocked (true );
6262 }
6363 state_ = cei_state_e::CONNECTING;
@@ -78,18 +78,18 @@ void local_uds_client_endpoint_impl::start() {
7878
7979void local_uds_client_endpoint_impl::stop () {
8080 {
81- std::lock_guard<std::recursive_mutex> its_lock (mutex_);
81+ std::scoped_lock its_lock (mutex_);
8282 sending_blocked_ = true ;
8383 }
8484 {
85- std::lock_guard<std::mutex> its_lock (connect_timer_mutex_);
85+ std::scoped_lock its_lock (connect_timer_mutex_);
8686 connect_timer_.cancel ();
8787 }
8888 connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT;
8989
9090 bool is_open (false );
9191 {
92- std::lock_guard<std::mutex> its_lock (socket_mutex_);
92+ std::scoped_lock its_lock (socket_mutex_);
9393 is_open = socket_->is_open ();
9494 }
9595 if (is_open) {
@@ -116,7 +116,7 @@ void local_uds_client_endpoint_impl::connect() {
116116 start_connecting_timer ();
117117 boost::system::error_code its_connect_error;
118118 {
119- std::lock_guard<std::mutex> its_lock (socket_mutex_);
119+ std::lock_guard its_lock (socket_mutex_);
120120 boost::system::error_code its_error;
121121 socket_->open (remote_.protocol (), its_error);
122122
@@ -153,7 +153,7 @@ void local_uds_client_endpoint_impl::connect() {
153153 }
154154 std::size_t operations_cancelled;
155155 {
156- std::lock_guard<std::mutex> its_lock (connecting_timer_mutex_);
156+ std::lock_guard its_lock (connecting_timer_mutex_);
157157 operations_cancelled = connecting_timer_.cancel ();
158158 connecting_timer_state_ = connecting_timer_state_e::FINISH_ERROR;
159159 if (operations_cancelled != 0 ) {
@@ -174,7 +174,7 @@ void local_uds_client_endpoint_impl::connect() {
174174}
175175
176176void local_uds_client_endpoint_impl::receive () {
177- std::lock_guard<std::mutex> its_lock (socket_mutex_);
177+ std::lock_guard its_lock (socket_mutex_);
178178 if (socket_->is_open ()) {
179179 socket_->async_receive (
180180 boost::asio::buffer (recv_buffer_),
@@ -232,11 +232,11 @@ void local_uds_client_endpoint_impl::send_queued(std::pair<message_buffer_ptr_t,
232232 bufs.push_back (boost::asio::buffer (its_end_tag));
233233
234234 {
235- std::lock_guard<std::mutex> its_lock (socket_mutex_);
235+ std::scoped_lock its_lock (socket_mutex_);
236236
237237 auto its_me {std::dynamic_pointer_cast<local_uds_client_endpoint_impl>(shared_from_this ())};
238238 auto buffer_ptr = _entry.first ; // Capture shared_ptr to ensure it stays alive
239-
239+
240240 if (socket_->is_open ()) {
241241 boost::asio::async_write (
242242 *socket_, bufs,
@@ -247,7 +247,7 @@ void local_uds_client_endpoint_impl::send_queued(std::pair<message_buffer_ptr_t,
247247 VSOMEIP_WARNING << " lucei::" << __func__ << " : try to send while socket was not open | endpoint > " << this ;
248248 was_not_connected_ = true ;
249249 is_sending_ = false ;
250- }
250+ }
251251 }
252252}
253253
@@ -287,7 +287,7 @@ void local_uds_client_endpoint_impl::receive_cbk(
287287 }
288288 error_handler_t handler;
289289 {
290- std::lock_guard<std::mutex> its_lock (error_handler_mutex_);
290+ std::scoped_lock its_lock (error_handler_mutex_);
291291 handler = error_handler_;
292292 }
293293 if (handler)
@@ -394,7 +394,7 @@ void local_uds_client_endpoint_impl::max_allowed_reconnects_reached() {
394394 << get_remote_information ();
395395 error_handler_t handler;
396396 {
397- std::lock_guard<std::mutex> its_lock (error_handler_mutex_);
397+ std::scoped_lock its_lock (error_handler_mutex_);
398398 handler = error_handler_;
399399 }
400400 if (handler)
0 commit comments