aboutsummaryrefslogtreecommitdiffstats
path: root/src/can_decode_message.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-27 21:29:07 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-27 21:29:07 +0100
commitf9d6b3b462fa3db5a70e8bd1e1625d35f9e0f21b (patch)
treee272d292c0e0df9803be2ccb66ac43c8f77bfe8e /src/can_decode_message.cpp
parent7c40ad1076fa608863eb62991d436267dab43dbb (diff)
In class mutex and condition variable except for subscribed_signals map
For now... Change-Id: I133deb39fcd0660064b3b3c2a52f86ad37cb29c2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can_decode_message.cpp')
-rw-r--r--src/can_decode_message.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/can_decode_message.cpp b/src/can_decode_message.cpp
index c311e98a..ed518f1e 100644
--- a/src/can_decode_message.cpp
+++ b/src/can_decode_message.cpp
@@ -38,8 +38,8 @@ void can_decode_message(can_bus_t &can_bus)
while(can_bus.is_decoding())
{
{
- std::unique_lock<std::mutex> can_message_lock(can_message_mutex);
- new_can_message.wait(can_message_lock);
+ std::unique_lock<std::mutex> can_message_lock(can_bus.get_can_message_mutex());
+ can_bus.get_new_can_message().wait(can_message_lock);
can_message = can_bus.next_can_message();
}
@@ -51,7 +51,7 @@ void can_decode_message(can_bus_t &can_bus)
for(auto& sig : signals)
{
{
- std::lock_guard<std::mutex> subscribed_signals_lock(subscribed_signals_mutex);
+ std::lock_guard<std::mutex> subscribed_signals_lock(get_subscribed_signals_mutex());
std::map<std::string, struct afb_event> subscribed_signals = get_subscribed_signals();
const auto& it_event = subscribed_signals.find(sig.genericName);
@@ -63,10 +63,10 @@ void can_decode_message(can_bus_t &can_bus)
openxc_SimpleMessage s_message = build_SimpleMessage(sig.genericName, decoded_message);
vehicle_message = build_VehicleMessage_with_SimpleMessage(openxc_DynamicField_Type::openxc_DynamicField_Type_NUM, s_message);
- std::lock_guard<std::mutex> decoded_can_message_lock(decoded_can_message_mutex);
+ std::lock_guard<std::mutex> decoded_can_message_lock(can_bus.get_decoded_can_message_mutex());
can_bus.push_new_vehicle_message(vehicle_message);
}
- new_decoded_can_message.notify_one();
+ can_bus.get_new_decoded_can_message().notify_one();
}
}
}