Use an atomic variable for tracking instanceIds in HttpDataStream

This commit is contained in:
casey langen 2020-10-22 00:06:42 -07:00
parent b563d512d1
commit ed4f2440a6

View File

@ -51,6 +51,7 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <chrono> #include <chrono>
#include <atomic>
/* meh... */ /* meh... */
#include <../../3rdparty/include/nlohmann/json.hpp> #include <../../3rdparty/include/nlohmann/json.hpp>
@ -75,7 +76,7 @@ static IEnvironment* environment;
static LruDiskCache diskCache; static LruDiskCache diskCache;
static std::string cachePath; static std::string cachePath;
static IPreferences* prefs; static IPreferences* prefs;
static int64_t nextInstanceId = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count(); static std::atomic<int64_t> nextInstanceId = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
static const int kDefaultMaxCacheFiles = 35; static const int kDefaultMaxCacheFiles = 35;
static const int kDefaultPreCacheSizeBytes = 524288; /*2^19 */ static const int kDefaultPreCacheSizeBytes = 524288; /*2^19 */