summaryrefslogtreecommitdiffstats
path: root/src/can-signals.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-signals.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-signals.cpp')
-rw-r--r--src/can-signals.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/can-signals.cpp b/src/can-signals.cpp
index 0a6a829c..54c03425 100644
--- a/src/can-signals.cpp
+++ b/src/can-signals.cpp
@@ -29,6 +29,18 @@ std::vector<std::vector<CanSignal>> SIGNALS {
{}// message set: example
};
+/**
+* @brief Mutex allowing safe manipulation on subscribed_signals map.
+* @desc To ensure that the map object isn't modified when we read it, you
+* have to set this mutex before use subscribed_signals map object.
+*/
+std::mutex subscribed_signals_mutex;
+
+std::mutex& get_subscribed_signals_mutex()
+{
+ return subscribed_signals_mutex;
+}
+
const std::vector<CanSignal> getSignals()
{
return SIGNALS[MESSAGE_SET_ID];