Skip to content

Commit

Permalink
Remove the thread-local specifier for last_uuid_time, to avoid duplic…
Browse files Browse the repository at this point in the history
…ate UUIDs, if used in multiple threads.
  • Loading branch information
Harald Nøkland committed Apr 7, 2022
1 parent f4046ea commit b47e325
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace sole {
uuid_time = uuid_time + (tp.tv_nsec / 100);

// If the clock looks like it went backwards, or is the same, increment it.
static $msvc( __declspec(thread)) $melse( __thread ) uint64_t last_uuid_time = 0;
static uint64_t last_uuid_time = 0;
if( last_uuid_time >= uuid_time )
uuid_time = ++last_uuid_time;
else
Expand Down

0 comments on commit b47e325

Please sign in to comment.