Fix data race in test case

This commit is contained in:
Sebastian Messmer 2018-09-26 19:54:11 -07:00
parent 2786558210
commit ff62fe9e84
3 changed files with 4 additions and 3 deletions

View File

@ -1,2 +1,2 @@
Change homebrew recipe to "brew install libomp" but not "brew install cryptopp" Change homebrew recipe to "brew install libomp" but not "brew install cryptopp"
Change AppVeyor Badge to master branch Change AppVeyor Badge to master branch

View File

@ -1,3 +1,3 @@
#include "MinimalValueType.h" #include "MinimalValueType.h"
int MinimalValueType::instances = 0; std::atomic<int> MinimalValueType::instances(0);

View File

@ -5,11 +5,12 @@
#include <cpp-utils/macros.h> #include <cpp-utils/macros.h>
#include <cassert> #include <cassert>
#include <cpp-utils/assert/assert.h> #include <cpp-utils/assert/assert.h>
#include <atomic>
// This is a not-default-constructible non-copyable but moveable Value type // This is a not-default-constructible non-copyable but moveable Value type
class MinimalValueType { class MinimalValueType {
public: public:
static int instances; static std::atomic<int> instances;
static MinimalValueType create(int value) { static MinimalValueType create(int value) {
return MinimalValueType(value); return MinimalValueType(value);