Skip to content

Commit a95250a

Browse files
committed
Made uuid gen to thread_local.
It requires generetor creation cost only one timer per threads. And then, no locks are required.
1 parent abd766e commit a95250a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/mqtt/broker/uuid.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ MQTT_BROKER_NS_BEGIN
1919

2020
inline std::string create_uuid_string() {
2121
// See https://github.com/boostorg/uuid/issues/121
22-
auto gen = boost::uuids::random_generator();
22+
static thread_local auto gen = boost::uuids::random_generator();
2323
return boost::uuids::to_string(gen());
2424
}
2525

0 commit comments

Comments
 (0)