summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-05-19 08:49:52 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-05-19 08:49:52 (GMT)
commit747781cbebe22efb4f2efb8f3269320962791914 (patch)
tree0c6df03ea42971d04695f3f6b295fc18c9113699 /src
parent827bd207b54839dfa3d24c1b65afb638b9b5cd0e (diff)
downloaduscxml-747781cbebe22efb4f2efb8f3269320962791914.zip
uscxml-747781cbebe22efb4f2efb8f3269320962791914.tar.gz
uscxml-747781cbebe22efb4f2efb8f3269320962791914.tar.bz2
Worked on issue 131
Update boost Spent a mutex for UUIDgen
Diffstat (limited to 'src')
-rw-r--r--src/uscxml/util/UUID.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/uscxml/util/UUID.cpp b/src/uscxml/util/UUID.cpp
index 6f7cf96..bc63ecd 100644
--- a/src/uscxml/util/UUID.cpp
+++ b/src/uscxml/util/UUID.cpp
@@ -20,6 +20,7 @@
#include <sstream>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/random_generator.hpp>
+#include <mutex>
#include "UUID.h"
@@ -27,8 +28,13 @@ namespace uscxml {
// hide from public header
boost::uuids::random_generator uuidGen;
+std::mutex uuidMutex;
std::string UUID::getUUID() {
+ // boost.random objects are not guaranteed to be thread-safe
+ // see issue 131
+ std::lock_guard<std::mutex> lock(uuidMutex);
+
boost::uuids::uuid uuid = uuidGen();
std::ostringstream os;
os << uuid;
@@ -71,4 +77,4 @@ bool UUID::isUUID(const std::string& uuid) {
return true;
}
-} \ No newline at end of file
+}