fix race condition in CallAfterTimeoutTest
This commit is contained in:
parent
f040c8ca54
commit
400a5b5397
@ -1,6 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <cpp-utils/pointer/unique_ref.h>
|
||||
#include <cryfs-cli/CallAfterTimeout.h>
|
||||
#include <atomic>
|
||||
|
||||
using cpputils::unique_ref;
|
||||
using cpputils::make_unique_ref;
|
||||
@ -11,11 +12,13 @@ using namespace cryfs;
|
||||
|
||||
class CallAfterTimeoutTest : public ::testing::Test {
|
||||
public:
|
||||
CallAfterTimeoutTest(): called(false) {}
|
||||
|
||||
unique_ref<CallAfterTimeout> callAfterTimeout(milliseconds timeout) {
|
||||
return make_unique_ref<CallAfterTimeout>(timeout, [this] {called = true;});
|
||||
}
|
||||
|
||||
bool called = false;
|
||||
std::atomic<bool> called;
|
||||
};
|
||||
|
||||
TEST_F(CallAfterTimeoutTest, NoReset_1) {
|
||||
|
Loading…
Reference in New Issue
Block a user