diff --git a/README.md b/README.md index 699de10..2fbf008 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -sole +sole ==== - Sole is a lightweight C++11 library to generate universally unique identificators (UUID). @@ -73,6 +73,7 @@ uuid v4 rebuilt : bdd55e2f-6f6b-4088-8703-ddedba9456a2 -> version=4,randbits=bdd - clang/g++ users: both `-std=c++11` and `-lrt` may be required when compiling `sole.cpp` ### Changelog +- v1.0.4 (2022/04/09): Fix potential threaded issues (fix #18, PR #39) and a socket leak (fix #38) - v1.0.3 (2022/01/17): Merge fixes by @jasonwinterpixel(emscripten) + @jj-tetraquark(get_any_mac) - v1.0.2 (2021/03/16): Merge speed improvements by @vihangm - v1.0.1 (2017/05/16): Improve UUID4 and base62 performance; Fix warnings diff --git a/sole.hpp b/sole.hpp index 0658553..8673774 100644 --- a/sole.hpp +++ b/sole.hpp @@ -54,7 +54,8 @@ // public API -#define SOLE_VERSION "1.0.3" /* (2022/01/17): Merge fixes by @jasonwinterpixel(emscripten) + @jj-tetraquark(get_any_mac) +#define SOLE_VERSION "1.0.4" /* (2022/04/09): Fix potential threaded issues (fix #18, PR #39) and a socket leak (fix #38) +#define SOLE_VERSION "1.0.3" // (2022/01/17): Merge fixes by @jasonwinterpixel(emscripten) + @jj-tetraquark(get_any_mac) #define SOLE_VERSION "1.0.2" // (2021/03/16): Merge speed improvements by @vihangm #define SOLE_VERSION "1.0.1" // (2017/05/16): Improve UUID4 and base62 performance; fix warnings #define SOLE_VERSION "1.0.0" // (2016/02/03): Initial semver adherence; Switch to header-only; Remove warnings */ @@ -601,7 +602,7 @@ namespace sole { int s = socket(PF_INET, SOCK_DGRAM, 0); if (s == -1) continue; - if (std::strcmp("lo", ifap->ifa_name) == 0) continue; // loopback address is zero + if (std::strcmp("lo", ifap->ifa_name) == 0) { close(s); continue;} // loopback address is zero std::strcpy(ifr.ifr_name, ifap->ifa_name); int rc = ioctl(s, SIOCGIFHWADDR, &ifr); @@ -664,8 +665,8 @@ namespace sole { // UUID implementations inline uuid uuid4() { - static std::random_device rd; - static std::uniform_int_distribution dist(0, (uint64_t)(~0)); + static $msvc(__declspec(thread)) $melse(__thread) std::random_device rd; + static $msvc(__declspec(thread)) $melse(__thread) std::uniform_int_distribution dist(0, (uint64_t)(~0)); uuid my;