Skip to content

Commit 5441964

Browse files
committed
Remove explicit types on locks
Removed redundant converters Removed explicit template from unique_ptr throughout codebase
1 parent f58ba57 commit 5441964

File tree

15 files changed

+24
-23
lines changed

15 files changed

+24
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
/Testing
1717
/logs
1818
!build_qnx/*
19+
CMakeUserPresets.json

implementation/configuration/src/configuration_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2797,7 +2797,7 @@ const std::string& configuration_impl::get_logfile() const {
27972797
}
27982798

27992799
vsomeip_v3::logger::level_e configuration_impl::get_loglevel() const {
2800-
std::unique_lock<std::mutex> its_lock(mutex_loglevel_);
2800+
std::unique_lock its_lock{mutex_loglevel_};
28012801
return loglevel_;
28022802
}
28032803

implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void local_tcp_server_endpoint_impl::accept_cbk(connection::ptr _connection, boo
225225
if (!_error) {
226226
boost::system::error_code its_error;
227227
{
228-
std::unique_lock<std::mutex> its_socket_lock(_connection->get_socket_lock());
228+
std::unique_lock its_socket_lock{_connection->get_socket_lock()};
229229
auto& new_connection_socket = _connection->get_socket();
230230

231231
endpoint_type remote = new_connection_socket.remote_endpoint(its_error);
@@ -932,7 +932,7 @@ void local_tcp_server_endpoint_impl::print_status() {
932932

933933
std::size_t its_recv_size(0);
934934
{
935-
std::unique_lock<std::mutex> c_s_lock(c.second->get_socket_lock());
935+
std::unique_lock c_s_lock{c.second->get_socket_lock()};
936936
its_recv_size = c.second->get_recv_buffer_capacity();
937937
}
938938

implementation/endpoints/src/local_uds_server_endpoint_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ void local_uds_server_endpoint_impl::print_status() {
873873

874874
std::size_t its_recv_size(0);
875875
{
876-
std::unique_lock<std::mutex> c_s_lock(c.second->get_socket_lock());
876+
std::unique_lock c_s_lock{c.second->get_socket_lock()};
877877
its_recv_size = c.second->get_recv_buffer_capacity();
878878
}
879879

implementation/endpoints/src/tcp_client_endpoint_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void tcp_client_endpoint_impl::restart(bool _force) {
113113

114114
void tcp_client_endpoint_impl::connect() {
115115
start_connecting_timer();
116-
std::unique_lock<std::mutex> its_lock(socket_mutex_);
116+
std::unique_lock its_lock{socket_mutex_};
117117
boost::system::error_code its_error;
118118
socket_->open(remote_.protocol(), its_error);
119119

@@ -459,7 +459,7 @@ void tcp_client_endpoint_impl::receive_cbk(boost::system::error_code const& _err
459459
<< static_cast<int>( (_recv_buffer)[i] << " ";
460460
VSOMEIP_INFO << msg.str();
461461
#endif
462-
std::unique_lock<std::mutex> its_lock(socket_mutex_);
462+
std::unique_lock its_lock{socket_mutex_};
463463
std::shared_ptr<routing_host> its_host = routing_host_.lock();
464464
if (its_host) {
465465
std::uint32_t its_missing_capacity(0);

implementation/endpoints/src/udp_client_endpoint_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool udp_client_endpoint_impl::is_local() const {
4747
}
4848

4949
void udp_client_endpoint_impl::connect() {
50-
std::unique_lock<std::mutex> its_lock(socket_mutex_);
50+
std::unique_lock its_lock{socket_mutex_};
5151
boost::system::error_code its_error;
5252
socket_->open(remote_.protocol(), its_error);
5353
if (!its_error || its_error == boost::asio::error::already_open) {

implementation/routing/src/routing_manager_base.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ bool routing_manager_base::insert_subscription(service_t _service, instance_t _i
13651365

13661366
std::shared_ptr<serializer> routing_manager_base::get_serializer() {
13671367

1368-
std::unique_lock<std::mutex> its_lock(serializer_mutex_);
1368+
std::unique_lock its_lock{serializer_mutex_};
13691369
while (serializers_.empty()) {
13701370
VSOMEIP_INFO << __func__ << ": Client " << std::hex << std::setfill('0') << std::setw(4) << get_client()
13711371
<< " has no available serializer. Waiting...";
@@ -1389,7 +1389,7 @@ void routing_manager_base::put_serializer(const std::shared_ptr<serializer>& _se
13891389

13901390
std::shared_ptr<deserializer> routing_manager_base::get_deserializer() {
13911391

1392-
std::unique_lock<std::mutex> its_lock(deserializer_mutex_);
1392+
std::unique_lock its_lock{deserializer_mutex_};
13931393
while (deserializers_.empty()) {
13941394
VSOMEIP_INFO << std::hex << "client " << get_client() << "routing_manager_base::get_deserializer ~> all in use!";
13951395
deserializer_condition_.wait(its_lock, [this] { return !deserializers_.empty(); });

implementation/routing/src/routing_manager_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ void routing_manager_stub::on_offered_service_request(client_t _client, offer_ty
818818
}
819819

820820
void routing_manager_stub::client_registration_func(void) {
821-
std::unique_lock<std::mutex> its_lock(client_registration_mutex_);
821+
std::unique_lock its_lock{client_registration_mutex_};
822822
while (client_registration_running_) {
823823
client_registration_condition_.wait(
824824
its_lock, [this] { return !pending_client_registrations_queue_.empty() || !client_registration_running_; });

implementation/runtime/src/application_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,7 @@ void application_impl::register_async_subscription_handler(service_t _service, i
25822582
VSOMEIP_INFO << __func__ << ": (" << std::hex << std::setfill('0') << std::setw(4) << get_client() << "): [" << std::setw(4) << _service
25832583
<< "." << std::setw(4) << _instance << "." << std::setw(4) << _eventgroup << "]";
25842584

2585-
std::scoped_lock<std::mutex> its_lock(subscription_mutex_);
2585+
std::scoped_lock its_lock(subscription_mutex_);
25862586
subscription_[_service][_instance][_eventgroup] = std::make_pair(nullptr, _handler);
25872587
}
25882588

implementation/service_discovery/src/service_discovery_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,7 @@ void service_discovery_impl::check_ttl(const boost::system::error_code& _error)
23552355
// update_routing_info
23562356
if (!_error) {
23572357
{
2358-
std::unique_lock<std::mutex> its_lock(check_ttl_mutex_, std::try_to_lock);
2358+
std::unique_lock its_lock{check_ttl_mutex_, std::try_to_lock};
23592359
if (its_lock.owns_lock()) {
23602360
its_counter = 0;
23612361
host_->update_routing_info(ttl_timer_runtime_);

0 commit comments

Comments
 (0)